mysql创建用户及赋予权限

洼地云 tuoyidashi.png

mysql新版本和以前的版本有些区别:

mysql 8

CREATE USER 'seafile' IDENTIFIED BY 'Passw0rd';
GRANT ALL ON *.* TO 'seafile'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
ALTER USER 'seafile'@'%' IDENTIFIED WITH mysql_native_password BY 'Passw0rd';

mysql 8如果使用以前的赋予权限命令会报下面的错误:

mysql> grant all privileges  on *.* to seafile@'localhost' identified by 'Passw0rd';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by 'Passw0rd'' at line 1

mysql 8以前的版本

CREATE USER 'seafile' IDENTIFIED BY 'Passw0rd';
grant all privileges  on *.* to seafile@'localhost' IDENTIFIED BY 'Passw0rd';
grant all privileges  on *.* to seafile@'127.0.0.1' IDENTIFIED BY "Passw0rd";
grant all privileges  on *.* to seafile@'%' IDENTIFIED BY "Passw0rd";
FLUSH PRIVILEGES;

grant all privileges  on *.* to seafile@'10.47.0.238' IDENTIFIED BY "Passw0rd";
grant all privileges  on *.* to seafile@'10.47.0.238' IDENTIFIED BY "Passw0rd";
grant all privileges  on *.* to seafile@'%' IDENTIFIED BY "Passw0rd";
FLUSH PRIVILEGES;
赞(0)
未经允许禁止转载:优米格 » mysql创建用户及赋予权限
comment-img.png

评论 抢沙发

合作&反馈&投稿

商务合作、问题反馈、投稿,欢迎联系

广告合作侵权联系

登录

找回密码

注册

Ads Blocker Image Powered by Code Help Pro

检测到广告已被屏蔽

您好,系统检测到您使用了广告屏蔽组件。

本网站并不包含任何侵入性广告,我们提供免费的内容,但是需要广告收入来维持运营,还请将本站加入拦截白名单!