一、wget http://dev.mysql.com/get/mysql57-community-release-el6-8.noarch.rpm
二、yum localinstall mysql57-community-release-el6-8.noarch.rpm
三、yum install mysql-server
四、mysqld --initialize --user=mysql
五、找到密码 vi /var/log/mysqld.log
六、登录 mysql -uroot -p初始密码
七、修改密码 ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
八、chkconfig mysqld on
九、reboot
十、mysql -uroot -p
创建新用户并授权
CREATE USER 'pig'@'%' IDENTIFIED BY '123456';
%表示该用户可以从任意远程主机登陆
GRANT ALL ON *.* TO 'pig'@'%';
错误显示:
软件包:mysql-community-server-5.7.20-1.el6.x86_64 (mysql57-community)
需要:libsasl2.so.2()(64bit)
您可以尝试添加 --skip-broken 选项来解决该问题
您可以尝试执行:rpm -Va --nofiles --nodigest
解决方法:
修改vim /etc/yum.repos.d/mysql-community.repo 源文件
[mysql57-community]
name=MySQL 5.7 Community Server
## baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
错误提示:
mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
解决方法:
尝试重启mysqld服务
service mysqld start
网友评论