linux环境下安装mysql数据库遇到的问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux环境下安装mysql数据库遇到的问题相关的知识,希望对你有一定的参考价值。

总结一句话:
安装完mysql数据库记得授权远程登录。
 
坑的现象:
ERROR 1045 (28000): Access denied for user ‘guoxp‘@‘localhost‘ (using password: YES)
 
解决方案如下:
执行前查看状态:
MariaDB [mysql]>  select Host,User,Password from user ;
+-----------------------+-------+-------------------------------------------+
| Host                  | User  | Password                                  |
+-----------------------+-------+-------------------------------------------+
| localhost             | root  |                                           |
| localhost.localdomain | root  |                                           |
| 127.0.0.1             | root  |                                           |
| ::1                   | root  |                                           |
| localhost             |       |                                           |
| localhost.localdomain |       |                                           |
+-----------------------+-------+-------------------------------------------+
6 rows in set (0.00 sec)
 
 
授权:
MariaDB [mysql]> grant select,update,insert,delete on *.* to [email protected]远程登录的ip地址 identified by "远程登录的密码";
Query OK, 0 rows affected (0.00 sec)
 
执行后查看状态:
MariaDB [mysql]>  select Host,User,Password from user ;
+-----------------------+-------+-------------------------------------------+
| Host                  | User  | Password                                  |
+-----------------------+-------+-------------------------------------------+
| localhost             | root  |                                           |
| localhost.localdomain | root  |                                           |
| 127.0.0.1             | root  |                                           |
| ::1                   | root  |                                           |
| localhost             |       |                                           |
| localhost.localdomain |       |                                           |
| 远程登录的ip地址        | guoxp | *FA074CDA355DAA0D0E53ABE2885985ECEB743D7A |
+-----------------------+-------+-------------------------------------------+
7 rows in set (0.01 sec)

以上是关于linux环境下安装mysql数据库遇到的问题的主要内容,如果未能解决你的问题,请参考以下文章

虚拟机安装mysql遇到的坑

linux下安装mysql遇到的一些问题

linux 无外网情况下安装 mysql

linux下源代码搭建php环境之mysql

安装mysql遇到的问题

Linux下安装启动MySQL