MySQL-mysql-5.7.30-el7-x86_64.tar.gz安装笔记
VM版本:VMware Workstation Pro v15.5.1
系统版本:CentOS 7.7 1908
mysql下载地址:https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.30-el7-x86_64.tar.gz
MariaDB卸载:
1、检查MariaDB:yum list installed | grep mariadb
2、卸载MariaDB:yum -y remove mariadb-libs.x86_64
MySQL安装:
1、解压MySQL安装包:tar -zxvf mysql-5.7.30-el7-x86_64.tar.gz -C /usr/local
2、进入解压所在目录并修改文件夹名称:mv mysql-5.7.30-el7-x86_64 mysql-5.7.30-el7
3、在MySQL的目录下创建数据文件夹:mkdir data
4、创建一个新用户用来执行mysqld命令:useradd mysql
5、./mysqld --initialize --user=mysql --datadir=/usr/local/mysql-5.7.30-el7/data --basedir=/usr/local/mysql-5.7.30-el7
6、开启数字加密生成数字证书:./mysql_ssl_rsa_setup --datadir=/usr/local/mysql-5.7.30-el7/data
7、赋予mysql用户操作数据库的权限:chown -R mysql:mysql /usr/local/mysql-5.7.30-el7/
8、后台启动数据库:./mysqld_safe &
7、登录数据库:./mysql -uroot -p
8、重新设置密码:alter user 'root'@'localhost' identified by '123456';
9、授权远程访问:grant all privileges on *.* to root@'%'identified by '123456';
10、立即刷新权限:flush privileges;
11、关闭Linux防火墙:
查看防火墙状态:systemctl status firewalld
禁用防火墙服务:systemctl disable firewalld
启用防火墙服务:systemctl enable firewalld
关闭防火墙:systemctl stop firewalld
开启防火墙:systemctl start firewalld
12、查看是否开启SSL:show global variables like '%ssl%';
13、修改隔离级别:
查询事务级别:show global variables like '%isolation%';
修改全局事务级别:set global transaction isolation level read committed;
修改会话事务级别:set session transaction isolation level read committed;
其他:1)最好是在安装过程中就开启SSL 2)高版本号的mysql输入开启SSL指令无返回提示