顿搜
飞过闲红千叶,夕岸在哪
类目归类
下载地址:MySQL下载页
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpmrpm -ivh mysql-community-release-el7-5.noarch.rpm安装这个包后,会获得两个mysql的yum repo源:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo。
yum install mysql-servermysql -u root登录时有可能报这样的错:ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2),原因是/var/lib/mysql的访问权限问题。下面的命令把/var/lib/mysql的拥有者改为当前用户:
chown -R root:root /var/lib/mysql然后,重启服务:
service mysqld restart接下来登录重置密码:
mysql -u root
use mysql;
update user set password=password('password') where user=‘root‘;
flush privileges;
quit;
service mysqld restart;firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload如果出现FirewallD is not running, 请先启动firewallsystemctl start firewalld进入mysql后
GRANT ALL ON *.* TO root@'%'IDENTIFIED BY 'password' WITH GRANT OPTION;
quit;
service mysqld restartgrant all on dbname.* to 'user1'@'%' identified by 'password';
grant all on dbname.* to 'user1'@'localhost' identified by 'password';
exit;
service mysqld restart