龙蜥7.9 rpm安装mysql
1、拿到下图几个rpm包
2、依次执行如下安装命令
rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm --nodeps --force rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm --nodeps --force rpm -ivh mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm --nodeps --force rpm -ivh mysql-community-devel-5.7.19-1.el7.x86_64.rpm --nodeps --force rpm -ivh mysql-community-client-5.7.19-1.el7.x86_64.rpm --nodeps --force rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm --nodeps --force
3、先改一下配置文件(我先启动了,再改配置文件,遇到各种问题,所以改吧)(另外就是我需要把data放到/data挂载的磁盘上)
vi /etc/my.cnf
skip-grant-tables #免密进入
datadir=/data/var/lib/mysql #变更数据目录
创建/data/var/lib/mysql
cd /data mkdir -p var/lib/mysql chmod 777 mysql chown -R mysql:mysql mysql
4、启动
systemctl start mysqld
systemctl enable mysqld
5、免密登录-配置root密码 mysql-uroot -p
mysql -uroot -p #直接回车进入
update mysql.user set authentication_string=password('1234qwer') where user='root';
flush privileges;
exit
vi /etc/my.cnf #skip-grant-tables注释掉
systemctl
restart mysqld.service
6、创建haha数据库和授权haha用户。最好重新登录一下,检查配置是否生效
create user 'uhaha'@'%' identified by 'haha123456'; CREATE DATABASE `dhaha` /*!40100 COLLATE 'utf8_general_ci' */; grant all privileges on `dhaha`.* to 'uhaha'@'%'; flush privileges;
use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
set global validate_password_policy=LOW;
7、用客户端测试一下