--建数据库
create database zxlh default character set utf8;
--建用户,只访问zxlh数据库,%表示不限制任何ip
grant all PRIVILEGES on zxlh.* to 'zxlh'@'%' identified by 'zxlh';
--建用户,访问所有数据库
grant all PRIVILEGES on *.* to 'root'@'%' identified by '123456' WITH GRANT OPTION;
--刷新
flush privileges;
更细致的权限分配可以通过工具比如 navicte
用户信息可以在MySQL.user中看到
use mysql
select host,user,passsword from user;
忘记密码:
service mysql55-mysqld stop
mysqld_safe --user=root --skip-grant-tables
mysql -u root
use mysql
update user set password=password("new_pass") where user="root";
flush privileges;
文章题目:创建用户,库及权限的分配
文章来源:
http://cdxtjz.com/article/ihjppg.html