linux下用yum安裝mysql
Linux系統自帶的repo是不會自動更新每個軟體的最新版本(基本都是比較靠後的穩定版),所以無法通過yum方式安裝MySQL的高階版本。所以我們需要先安裝帶有當前可用的mysql5系列社群版資源的rpm包。
#######安裝rpm包
[[email protected] ~]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Retrieving http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-release-el7-5 ################################# [100%]
檢視當前可用的mysql安裝資源:
[[email protected] ~]# yum repolist enabled | grep "mysql.*-community.*"
!mysql-connectors-community/x86_64 MySQL Connectors Community 2
!mysql-tools-community/x86_64 MySQL Tools Community 3
!mysql56-community/x86_64 MySQL 5.6 Community Server 22
[
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00
epel/x86_64/metalink | 4.9 kB 00:00
extras | 3.4 kB 00:00
mysql-connectors-community | 2.5 kB 00:00
mysql-tools-community | 2.5 kB 00:00
mysql56-community | 2.5 kB 00:00
updates | 3.4 kB 00:00
updates/7/x86_64/primary_db | 4.9 MB 00:05
……………………
Installing : mysql-community-common-5.6.30-2.el7.x86_64 1/4
Installing : mysql-community-libs-5.6.30-2.el7.x86_64 2/4
Installing : mysql-community-client-5.6.30-2.el7.x86_64 3/4
Installing : mysql-community-server-5.6.30-2.el7.x86_64 4/4
Verifying : mysql-community-client-5.6.30-2.el7.x86_64 1/4
Verifying : mysql-community-common-5.6.30-2.el7.x86_64 2/4
Verifying : mysql-community-libs-5.6.30-2.el7.x86_64 3/4
Verifying : mysql-community-server-5.6.30-2.el7.x86_64 4/4
Installed:
mysql-community-server.x86_64 0:5.6.30-2.el7
Dependency Installed:
mysql-community-client.x86_64 0:5.6.30-2.el7 mysql-community-common.x86_64 0:5.6.30-2.el7 mysql-community-libs.x86_64 0:5.6.30-2.el7
Complete!
#######安裝成功後,將其加入開機啟動
[[email protected] ~]# systemctl enable mysqld
#######啟動mysql服務程序
[[email protected] ~]# systemctl start mysqld
#######配置mysql(設定密碼等)
[[email protected] ~]# mysql_secure_installation(這個命令下面有幾步操作,自己百度這個命令會有操作的步驟!)
然後他媽的問題來了 mysql只能本地訪問 開啟遠端訪問許可權
在安裝mysql的機器上執行:
1、d:/mysql/bin/>mysql -h localhost -u root //這樣應該可以進入MySQL伺服器
2、mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION //賦予任何主機訪問資料的許可權
3、mysql>FLUSH PRIVILEGES //修改生效
4、mysql>EXIT //退出MySQL伺服器
這樣就可以在其它任何的主機上以root身份登入啦!