创建MySQL数据库的时候大坑
Topic source#创建新用户
create user 'www-data'@'%' identified by 'www-data';
#创建数据库
drop database if exists awesome;
create database awesome;
#给新用户赋权限
grant select, insert, update, delete,create on awesome.* to 'www-data'@'localhost' identified by 'www-data';
MySQL8.0 后。赋权去掉identified by 'www-data'; 否则会报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 'develop''
https://stackoverflow.com/questions/50177216/how-to-grant-all-privileges-to-root-user-in-mysql-8-0
Starting with MySQL 8 you no longer can (implicitly) create a user using the GRANT
command. Use CREATE USER instead, followed by the GRANT statement:
mysql> CREATE USER `www-data`@'localhost' IDENTIFIED BY 'www-data';
mysql> GRANT ALL PRIVILEGES ON *.* to 'www-data'@'localhost' WITH GRANT OPTION
这样是吗
- 1
hello_world_wl
新版的MySQL有变动,sql语句里面的: grant select, insert, update, delete on awesome.* to 'www-data'@'localhost' identified by 'www-data'; 会报错的。 解决方案: 先create 用户——>再grant给各种权限。 具体代码自己查MySQL语法。 这里一直报错我也是醉了。