Mysql命令行添加新用户
创建用户root ,密码为123456,@%代表登录主机通配
CREATE USER 'root'@'%' IDENTIFIED BY '123456';
刷新
flush privileges;
授权
GRANT ALL ON cloud_note.* TO 'root'@'%';
mysql> CREATE USER 'root'@'%' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user from mysql.user;
+-----------+-----------+
| host | user |
+-----------+-----------+
| % | root |
| localhost | mysql.sys |
| localhost | mysqlxsys |
| localhost | root |
+-----------+-----------+
4 rows in set (0.00 sec)
mysql> GRANT ALL ON cloud_note.* TO 'root'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user from mysql.user;
+-----------+-----------+
| host | user |
+-----------+-----------+
| % | root |
| localhost | mysql.sys |
| localhost | mysqlxsys |
| localhost | root |
+-----------+-----------+
4 rows in set (0.00 sec)