检查是否安装mysql
rpm -qa | grep mysql
检查已安装的Mariadb
rpm -qa | grep -i mariadb
卸载已安装的Mariadb数据库
rpm -qa | grep mariadb | xargs rpm -e --nodeps
下载mysql5.6安装包文件
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
安装rpm包
rpm -ivh mysql-community-release-el7-5.noarch.rpm
查看可用的mysql安装文件
yum repolist all | grep mysql
安装mysql
yum install mysql-server
检查mysql是否安装成功
rpm -qa | grep mysql
启动mysql
systemctl start mysql.service
systemctl stop mysql
systemctl status mysql
systemctl enable mysql #开机启动
修改root密码
# mysql -uroot
> use mysql;
> update user set password=PASSWORD('密码') where User='root';
> flush privileges;
设置远程访问权限
mysql> GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY '密码';
设置mysql表名不区分大小写
lower_case_table_names=1
重启mysql 使配置生效
systemctl restart mysqld.service
查看mysql 状态
systemctl status mysqld.service
至此mysql安装完成