Liunx环境安装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;