首页 > 数据库 > 文库 > 正文

创造用户,库及权限的分配

2022-08-03 16:44:58
字体:
来源:转载
供稿:网友
      --建数据库
     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;
 
忘记密码:
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;  

(编辑:错新网)

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选