1.1 查看mysql的安裝路徑: [root@bogon ~]# whereis mysql mysql: /usr/bin/mysql /usr/lib/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz 1.2 查看mysql的安裝包: ...
1.1 查看mysql的安裝路徑:
[root@bogon ~]# whereis mysql
mysql: /usr/bin/mysql /usr/lib/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
1.2 查看mysql的安裝包:
[root@bogon ~]# rpm -qa|grep mysql
mysql-community-client-5.6.26-2.el6.i686
mysql-community-release-el6-5.noarch
mysql-community-common-5.6.26-2.el6.i686
mysql-community-libs-5.6.26-2.el6.i686
mysql-community-server-5.6.26-2.el6.i686
1.3 卸載mysql
[root@bogon ~]# yum remove mysql
刪除mysql的資料庫文件:
刪除/var/llib/mysql目錄
1.4 安裝mysql
第一步:從oracle官方網站下載linux系統對應的mysql的yum源包。
第二步:把yum源包上傳到linux,安裝。
[root@bogon ~]# yum localinstall mysql-community-release-el6-5.noarch.rpm
[root@bogon ~]# yum install mysql-server
第三步:啟動mysql
[root@bogon ~]# service mysqld start
第四步:給root用戶設置密碼
[root@bogon ~]# /usr/bin/mysqladmin -u root password 'root'
第五步:遠程連接授權
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
註意:'myuser'、'mypassword' 需要替換成實際的用戶名和密碼。
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;