CentOS 7 安装MySQL 5.6遇到问题及解决方案

 

centos下安装mysql真的没有想象中那么容易,在这里我总结一下遇到的问题

 

1. ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

出现这种问题一般是MySQL-server没有安装成功,可以通过yum install MySQL-server-5.6.25-1.el7.x86_64.rpm重新安装

2. Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist

执行mysql_install_db –user=mysql

3. rpm安装mysql后/etc/目录下找不到my.cnf

whereis mysql查看mysql安装目录
  mysql: /usr/bin/mysql /usr/lib64/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
cp /usr/share/mysql/my-default.cnf /etc/my.cnf

4.ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)

# /etc/init.d/mysql stop
# mysqld_safe –user=mysql –skip-grant-tables –skip-Networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD(‘newpassword’) where USER=’root’; 
mysql> FLUSH PRIVILEGES; 
mysql> quit
# /etc/init.d/mysql restart

5.rpm -ivh安装时包 出现 file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64

[root@localhost install-files]# yum remove mysql-libs  

6.mysql在linux表明大小写敏感问题

编辑/etc/my.cnf在[mysqld]下插入lower_case_table_names=1
修改完成后重启mysql服务
通过show variables like '%case%',查看是否修改成功

7.MySQL不能远程连接Host is not allowed to connect to Host ‘10.72.35.8’ is not allowd to connect to this MySQL server

GRANT ALL PRIVILEGES ON . TO 'root'@'%'WITH GRANT OPTION; 
FLUSH PRIVILEGES

 

8.出现以下错误

[root@azrlnx06 jirasetup]# rpm -ivh MySQL-server-advanced-5.6.20-1.rhel5.x86_64.rpm 
Preparing... ################################# [100%]
Updating / installing...
1:MySQL-server-advanced-5.6.20-1.rh################################# [100%]
FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db:
Data::Dumper
[root@azrlnx06 jirasetup]# 

此时运行 yum install -y perl perl-devel

上一篇:Mysql数据类型


下一篇:MySQL到Elasticsearch数据同步