rpm方式安裝MySQL5.1.73
1.安裝MySQL server
首先下載好mysql的rpm安裝包
使用rpm命令安裝:
rpm -ivh MySQL-server-5.1.73-1.glibc23.i386.rpm
命令解釋:i:install v:顯示詳情 h:顯示進度條
問題:顯示軟件安裝與本機預裝的mysql沖突:
file
/usr/share/mysql/romanian/errmsg.sys from install of
MySQL-server-5.1.73-1.glibc23.i386 conflicts with file from package
mysql-libs-5.1.71-1.el6.i686
解決:
1.先找出這個包
rpm -qa | grep mysql
(q:query a:all)
2.使用rpm -e 擦除這個包,但是提示下面的依賴錯誤
說明別的軟件依賴這個包
但是可以采用暴力方式,解除依賴刪除:
使用命令:rpm -e mysql-libs-5.1.71-1.el6.i686 - -nodeps
重新執行安裝MySQL命令:
安裝server成功!顯示已經成功啟動server
2.安裝client端
使用命令:
rpm -ivh MySQL-client-5.1.73-1.glibc23.i386.rpm
3.使用命令初始化mysql數據庫(用戶名和密碼設置)
查看安裝過程中提醒的信息,主要告訴我們如何初始化數據庫:
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h itcast01 password ‘new-password’
Alternatively you can run:
/usr/bin/mysql_secure_installation
輸入如下命令初始化mysql:
/usr/bin/mysql_secure_installation
按照提示安裝:
Enter current password for root (enter for none):回車
Set root password? [Y/n]輸入 Y
New password:輸入新的密碼
Re-enter new password:再輸一遍密碼
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
4.使用客戶端登錄
mysql -uroot -p
輸入密碼
登錄成功!
rpm方式安裝MySQL5.1.73