链接:https://pan.baidu.com/s/1kRaK3oLkiwlcQaePTXq_mg
提取码:tyy7
-
先确认版本
rpm -qa | grep mariadb
卸载所有内容
rpm -e --nodeps mariadb-server-5.5.52-1.el7.x86_64
解压 myssql bundle
tar -xvf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar
安装 commons
rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
安装 Libs
rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
安装 Client
rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm
安装 Server
rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm -
检查安装结果
rpm -qa | grep mysql -
启动mysql服务
service mysqld start -
建立mysql短连接
ln -s /usr/bin /usr/local/mysql -
设置root密码(reference:http://www.cnblogs.com/peteremperor/p/6057987.html)
1,在/etc/my.cnf文件中[mysqld]处加入skip-grant-tables,保存,跳过身份验证。
2,重启MySql,使刚才修改的配置生效。
3,终端输入mysql,然后再输入use mysql;
4,终端输入UPDATE user SET Password = password (‘123456’ ) WHERe User = ‘root’ ; flush privileges ;
5,在/etc/my.cnf末尾 去掉skip-grant-tables,保存。
6,重启MySql,终端输入 mysql -u root -p ,然后根据提示输入刚设置的密码即可正常使用了。
说明:之所以要修改密码是因为出现Access denied for user ‘root’@'localhost’的错误,通过免密码登录的方式更改密码,输入update mysql.user set password=password(‘123456’) where user='root’时提示 Unknown column ‘password’ in ‘field list’,原来是mysql数据库下已经没有password这个字段了,password字段改成了authentication_string。
- 用alter命令重置密码(mysql要求)
1,mysql -u root -p
2,alter user ‘root’@‘localhost’ identified by ‘tyy777’;
这里提醒密码要设置难一点 特别是如果开启远程用户 远程工具连接的话 , 博主前些日子因为测试用的是123456 正式上线的时候没有更改 被黑了,也不能怪人家了 只能说自己。。。



