db

Centos 7 安装 MySQL8.0.16

2019-12-20  本文已影响0人  captainLii

官网


安装过程

gcc环境准备

命令:# yum -y install wget cmake gcc gcc-c++ ncurses ncurses-devel libaio-devel openssl openssl-devel

下载Yum Repository

命令: # wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

rpm

安装下载好的 Yum Repository

命令: # yum -y install mysql80-community-release-el7-3.noarch.rpm

安装rpm

安装MySQL服务器,安装将会花一点时间

命令: # yum -y install mysql-community-server

启动mysql

命令: # systemctl start mysqld.service

启动

查看Mysql状态

命令:# systemctl status mysqld.service

状态

重设MySQL密码

命令:# grep "password" /var/log/mysqld.log

命令: # mysql -uroot -p(输入刚查出来的密码)

登入MySQL

*重设置密码(new_password: 自定义的密码)

命令: # ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

设置密码

创建新的其它用户且允许远程登录(用户所有权限)

命令: # create user dyiaw@'%' identified by 'your_password';
# ALTER USER 'dyiaw'@'%' IDENTIFIED BY 'your_password' PASSWORD EXPIRE NEVER;
# ALTER USER 'dyiaw'@'%' IDENTIFIED WITH mysql_native_password BY 'your_password';
# GRANT ALL PRIVILEGES ON *.* TO 'captainLii'@'%'WITH GRANT OPTION;
# FLUSH PRIVILEGES;

创建用户且允许远程登录 授权

开放3306端口

命令: # firewall-cmd --zone=public --add-port=3306/tcp --permanent
# firewall-cmd --reload

开放3306端口

使用Navicat测试

Navicat连接MySQL

删除Yum Repository, 因为每次 yum 操作都会自动更新,需要把这个卸载掉mysql80-community-release-el7-3.noarch

命令:# yum -y remove mysql80-community-release-el7-3.noarch

删除release-el7-3.noarch

常用命令补充

# systemctl start mysqld.service # 启动mysql服务
# systemctl stop mysqld.service # 停止mysql服务
# systemctl restart mysqld.service # 重启mysql服务
# systemctl status mysqld.service # 查看mysql服务当前状态
# systemctl enable mysqld.service # 设置mysql服务开机自启动
# systemctl disable mysqld.service # 停止mysql服务开机自启动

解决:1055错误

1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

在navicat的对应库中打开命令窗口运行以下命令:

命令:SET @@global.sql_mode ="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION";

解决:1055错误

==== END ====
声明:原创,欢迎转载~! 记得点个关注我哦~!

上一篇 下一篇

猜你喜欢

热点阅读