mysql create user

#create a root password for


mysqladmin -u root password '19740415'


create user sil
mysql> CREATE USER sil IDENTIFIED BY '123';


Host | User
| %  | sil


then we must grant permission to sil user.
mysql> grant all on *.* to 'sil'@localhost' identified by '123'


sudo service mysqld stop


sudo service mysqld start


login use the user sil
mysql> mysql -u sil -p
Enter password: 123

should be able login with the user: sil


Creat a new user account using script

insert into mysql.user (Host,User,Password,ssl_cipher,x509_issuer,x509_subject) values("localhost","pppadmin",password("1234"),'','','');

grant all on test.* for 'pppadmin'@'localhost' identified by '1234'

sudo service mysqld stop

sudo service mysqld start

login use the user pppadmin
mysql> mysql -u pppadmin -p
Enter password: 1234

should be able login with the user: pppadmin

原文地址:https://www.cnblogs.com/greencolor/p/2314540.html