官网
安装过程
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

安装下载好的 Yum Repository
命令: # yum -y install mysql80-community-release-el7-3.noarch.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,重设密码
命令: # mysql -uroot -p(输入刚查出来的密码)

*重设置密码(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

使用Navicat测试

删除Yum Repository, 因为每次 yum 操作都会自动更新,需要把这个卸载掉mysql80-community-release-el7-3.noarch
命令:# yum -y remove mysql80-community-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";

网友评论