centos 安装mysql
查找以前是否装有MySQL
命令:rpm -qa | grep -i mysql
•下载
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
安装包
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
•安装Mysql
sudo yum install mysql-server
•更改权限
sudo chown -R mysql:mysql /var/lib/mysql
sudo service mysqld start
创建数据库用户:
CREATE USER 'xiaowu'@'<127.0.0.1>' IDENTIFIED BY '123456';
CREATE USER 'xiaowu'@'127.0.0.1' IDENTIFIED BY '123456';
CREATE USER 'xiaowu'@'%' IDENTIFIED BY '123456';
CREATE USER 'xiaowu'@'::1' IDENTIFIED BY '123456';
授予用户所有权限,[*.*]表示所有数据库 [to xiaowu] 表示用户是xiaowu
grant all privileges on *.* to xiaowu ;
flush privileges;
mysql访问配置添加3306端口:
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
service iptables save
service iptables restart
本文来自博客园,作者:.net&new,转载请注明原文链接:https://www.cnblogs.com/wugh8726254/p/16098422.html