2025-02-09

# vi mysqlusers.txt

create database dataname;
grant all privileges on dataname.* to username@localhost identified by ‘password‘;
flush privileges;

# /usr/local/mysql/bin/mysql -u root -p password < mysqlusers.txt

   藍色斜體部分為對應的用戶名和密碼,添加多個用戶及數據庫,隻需要復制中間部分代碼並修改對應的位置即可,如:
   create database dataname1;
   grant all privileges on dataname1.* to username1>@localhost” identified by ‘password‘;
   flush privileges;

   create database dataname2;
   grant all privileges on dataname2.* to username2>@localhost” identified by ‘password‘;
   flush privileges;

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *