centos7下快速安装mysql
Posted bluesky1
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7下快速安装mysql相关的知识,希望对你有一定的参考价值。
CentOS 7的yum源中貌似没有正常安装MySQL时的mysql-sever文件,需要去官网上下载
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server
初次安装mysql是root账户是没有密码的
设置密码的方法
# mysql -u root -p
mysql> update mysql.user set password=password(‘123456‘) where User="root" and Host="localhost";
mysql> exit
搞定!
远程授权连接mysql
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;
FLUSH PRIVILEGES;
卸载
#列出所有被安装的rpm package
rpm -qa | grep mariadb
强制卸载
rpm -e --nodeps
rpm方式安装的mysql
a)查看系统中是否以rpm包安装的mysql:
[[email protected] opt]# rpm -qa | grep -i mysql
MySQL-server-5.6.17-1.el6.i686
MySQL-client-5.6.17-1.el6.i686
b)卸载mysql
[[email protected] local]# rpm -e MySQL-server-5.6.17-1.el6.i686
[[email protected] local]# rpm -e MySQL-client-5.6.17-1.el6.i686
c)删除mysql服务
[[email protected] local]# chkconfig --list | grep -i mysql
[[email protected] local]# chkconfig --del mysql
d)删除分散mysql文件夹
[[email protected] local]# whereis mysql 或者 find / -name mysql
mysql: /usr/lib/mysql /usr/share/mysql
清空相关mysql的所有目录以及文件
rm -rf /usr/lib/mysql
rm -rf /usr/share/mysql
rm -rf /usr/my.cnf
以上是关于centos7下快速安装mysql的主要内容,如果未能解决你的问题,请参考以下文章