为 Mysql 数据库添加新用户的方法

发布时间:2017-09-29 19:43:11
 
这里以新建用户 test345为例:
 
1、登陆 Mysql 数据库:
 
mysql命令格式: mysql -h主机地址 -u用户名 -p用户密码
2、添加用户
 
mysql>use mysql;
mysql>create user 'test345'@'localhost';
mysql>grant all privileges on *.* to test345@localhost ;
mysql>update mysql.user set password=PASSWORD('123456') where user='test123';
mysql>flush privileges;
mysql>exit