昨天刚刚安装了MYSQL,玩着挺Happy的,今天就链接不上了,报错是:

root用户没有权限

翻阅了一些文章,看着不太方便,我简单归纳一下:

一、添加账户

账户是:test;密码是:123456

insert into mysql.user(Host,User,Password,ssl_cipher,x509_issuer,x509_subject) values("localhost","test",password("123456"),'','',''); 

登录成功之后,发现没有目标数据库的权限,接下来:

二、赋给权限

grant all privileges on mydays.* to test@192.168.1.102 identified by '1234';

三、重新登录

mysql -h192.168.1.102 -utest -p'1234'

结果:

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mydays             |
| test               |
+--------------------+
3 rows in set (0.01 sec)

 

相关文章:

  • 2022-03-08
  • 2022-02-21
猜你喜欢
  • 2022-12-23
  • 2021-12-05
  • 2021-12-22
  • 2021-10-15
  • 2021-05-11
  • 2021-07-29
  • 2021-12-12
相关资源
相似解决方案