1. 程式人生 > >CentOS 7 安裝MySQL 5.6遇到問題及解決方案

CentOS 7 安裝MySQL 5.6遇到問題及解決方案

linux localhost not ces name 解決 info target case

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 [email protected]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

[[email protected] 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 [email protected]%‘WITH GRANT OPTION; 
FLUSH PRIVILEGES

8.出現以下錯誤

[[email protected] 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
[[email protected] jirasetup]# 

此時運行 yum install -y perl perl-devel

CentOS 7 安裝MySQL 5.6遇到問題及解決方案