解决mysql连接不成功问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_26924703/article/details/85258819

service mysqld stop
/usr/bin/mysqld_safe --skip-grant-tables

再开一个终端

mysql -u root
use mysql;
select * from user;
desc user;
插入自己想的用户名和密码:insert into user(host,user,password) values('%', 'root', password('123456'));
flush privileges;

// 授权可以创建数据库
set global read_only=0;
flush privileges;
grant all privileges on *.* to 'root'@'localhost' identified by '123456' with grant option;
service mysqld restart;


// 远程可以访问
grant all privileges on pan.* to 'root'@'%' identified by '123456' with grant option;


// 可以存储过程
show grants for root;
grant execute on configdb.* to 'user_test1'@'%' IDENTIFIED BY PASSWORD '*00A51F3F48415C7D4E8908980D443C29C69B60C9';
flush privileges;
service mysqld restart;


// 查看权限
show grants for root@'%';

猜你喜欢

转载自blog.csdn.net/qq_26924703/article/details/85258819