ubuntu14.04 升級mysql到5.7版本

Ubuntu14.04默認安裝的是mysql5.5,因爲開發須要支持utf8mb4,所以須要升級到mysql5.7mysql

默認狀況下,apt是沒法直接升級到mysql5.7的,所以須要額外設置sql

首先,備份數據,儘管下面的方式不會丟失你的數據,可是爲了安全考慮,建議備份。數據庫

一、下載mysql-apt的配置包,並安裝ubuntu

wget https://dev.mysql.com/get/mysql-apt-config_0.8.1-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.1-1_all.deb

在安裝的過程當中,會要求選擇mysql版本,選擇mysql5.7版本後,點擊「OK」。安全

二、更新apt-get索引服務器

sudo apt-get update

三、安裝數據庫,在安裝過程當中,會自動卸載已經安裝的老版本數據。spa

sudo apt-get install mysql-server

四、安裝mysql 後,使用mysql_upgrade升級數據庫文件版本rest

sudo mysql_upgrade -uroot -p'youpassword'

五、重啓mysql,並檢查數據是否正常日誌

sudo service mysql restart
mysqlcheck -uroot -p'youpassword' --all-databases

六、若是一切正常,全部表的檢查結果均是ok狀態。code

同時,也能夠進入mysql使用select version(); 來查看mysql-server 版本號。

 

更新過程當中遇到的問題:

一、在ubuntu 14的版本中,安裝了mysql 後,啓動時,程序提示 「No directory, logging in with HOME=/」

root@xxx:/etc/mysql# service mysql restart
 * Stopping MySQL Community Server 5.7.11
...
 * MySQL Community Server 5.7.11 is stopped
 * Re-starting MySQL Community Server 5.7.11
No directory, logging in with HOME=/
..
 * MySQL Community Server 5.7.11 is started

解決辦法:

sudo service MySQL stop
sudo usermod -d /var/lib/mysql/ mysql
sudo service mysql start

 

二、安裝後遠程訪問mysql ,提示10061錯誤的問題

在更新mysql版本後,全部的配置文件都會被刪除,所以須要修改mysql配置。在Ubuntu中,配置文件在:

/etc/mysql/mysql.conf.d/mysql.cnf 
註銷配置文件中:bind-address =127.0.0.1 便可
/usr/bin                 客戶端程序和腳本  
/usr/sbin                mysqld 服務器  
/var/lib/mysql           日誌文件,數據庫  [重點要知道這個]  
/usr/share/doc/packages  文檔  
/usr/include/mysql       包含( 頭) 文件  
/usr/lib/mysql           庫  
/usr/share/mysql         錯誤消息和字符集文件  
/usr/share/sql-bench     基準程序  
相關文章
相關標籤/搜索