安裝MySQL
- 上傳MySQL-server-5.5.48-1.linux2.6.x8664.rpm到Linux上
-
解壓ta包 得到一大堆rpm檔案
tar -xvf MySQL-5.6.25-1.el6.x86_64.rpm-bundle.tarMySQL-client-5.6.25-1.el6.x86_64.rpm MySQL-devel-5.6.25-1.el6.x86_64.rpm MySQL-embedded-5.6.25-1.el6.x86_64.rpm MySQL-server-5.6.25-1.el6.x86_64.rpm MySQL-shared-5.6.25-1.el6.x86_64.rpm MySQL-shared-compat-5.6.25-1.el6.x86_64.rpm MySQL-test-5.6.25-1.el6.x86_64.rpm
-
rpm安裝mysql-server
rpm -ivh MySQL-server-5.6.25-1.el6.x86_64.rpm -
出現錯誤
file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 - 解除安裝 mariadb-libs-1:5.5.56-2.el7.x86_64 解決依賴
rpm -e –nodeps mariadb-libs-1:5.5.56-2.el7.x86_64 - 再次執行第三步 安裝server
- 安裝客戶端
rpm -ivhMySQL-client-5.6.25-1.el6.x86_64.rpm - 啟動mysql
service mysql start - 初始化mysql
/usr/bin/mysql_secure_installation - 測試mysql
mysql -u root -p
注意事項
初始化mysql時可能出現問題
- 先關閉mysql
service mysql stop - 跳過檢查
service mysql start –skip-grant-tables -
進入mysql 設定密碼
mysql> update mysql.user set password=PASSWORD(`newpassword`) where User=`root`; mysql> flush privileges; mysql> quit
- 重啟mysql
service mysql start - 連線
mysql -u root -p
備註
- 修改mysql密碼
set password for root@localhost = password(`123`);