mysql安装及错误解决

Posted 愤怒中的小草

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql安装及错误解决相关的知识,希望对你有一定的参考价值。

#下载mysql源安装包
shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
# 安装mysql源
shell> yum localinstall mysql57-community-release-el7-8.noarch.rpm
检查mysql源是否安装成功
shell> yum repolist enabled | grep "mysql.*-community.*"
安装MySQL
shell> yum install mysql-community-server
开机启动
shell> systemctl enable mysqld
shell> systemctl daemon-reload
/etc/my.cnf 新增如下三行
character_set_server=utf8
init_connect=‘SET NAMES utf8‘
validate_password = off  密码策略失效
常用命令:
shell> systemctl start mysqld
       systemctl stop mysqld
       systemctl restart mysqld
       systemctl status mysqld

首次登录
mysql -uroot -p
密码使用如下查找到的_ZfwDGlsd0=g
[[email protected] /]# grep ‘temporary password‘ /var/log/mysqld.log
2018-05-21T11:55:15.515167Z 1 [Note] A temporary password is generated for [email protected]: _ZfwDGlsd0=g
修改用户名密码
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘MyNewPass4!‘;
显示字符集
show variables like ‘%character%‘;
修改密码
mysqladmin -uroot -pMyNewPass4! password a123456
//创建用户
CREATE USER ‘abc‘@‘host‘ IDENTIFIED BY ‘abc123456‘;
//刷新系统权限表
flush privileges;

用navicat for mysql连接
报错:1130 host is not allowed to connect to
解决办法,执行如下命令:
 mysql -uroot -p
mysql>use mysql;
mysql>update user set host = ‘%‘ where user = ‘root‘;
mysql>select host, user from user;
mysql>flush privileges;













































以上是关于mysql安装及错误解决的主要内容,如果未能解决你的问题,请参考以下文章

安装 Apache+php+mysql+phpMyAdmin XAMPP及错误解决办法

MYSQL错误及解决典例

安装mysql 8 及 修复登录错误日志

MySQL 1130错误原因及解决方案

MySQL中的错误及解决方法

MySQL主从复制遇到的错误及解决方法