1.1 查看mysql的安装路径:
[[email protected] ~]# whereis mysql
mysql: /usr/bin/mysql /usr/lib/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
1.2 查看mysql的安装包:
[[email protected] ~]# 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
[[email protected] ~]# yum remove mysql
删除mysql的数据库文件:
删除/var/llib/mysql目录
1.4 安装mysql
第一步:从oracle官方网站下载linux系统对应的mysql的yum源包。
第二步:把yum源包上传到linux,安装。
[[email protected] ~]# yum localinstall mysql-community-release-el6-5.noarch.rpm
[[email protected] ~]# yum install mysql-server
第三步:启动mysql
[[email protected] ~]# service mysqld start
第四步:给root用户设置密码
[[email protected] ~]# /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;