linux系统mysql安装

1.将mysql安装包拖入 /opt/目录下
linux系统mysql安装
2.安装依赖包
安装依赖包(3个)
输入:
yum install -y perl
yum install -y net-tools
yum install -y autoconf

3.卸载冲突宝
卸载冲突包
rpm -qa | grep mariadb(查询冲突的包)
rpm -e 冲突的包 --nodeps
linux系统mysql安装
linux系统mysql安装
4.安装mysql
先安装客户端rpm -ivh MySQL-client-5.6.46-1.el7.x86_64.rpm
再安装服务端rpm -ivh MySQL-server-5.6.46-1.el7.x86_64.rpm

5.输入vi /usr/my.cnf 修改配置文件
linux系统mysql安装
6.启动mysql服务 service mysql start 或systemctl start mysql

7.免密登陆mysql数据库: 输入mysql 进入mysql库

8.修改密码: update user set password=password(‘ok’);

9.输入vi /usr/my.cnf 修改配置文件,把免密登陆注释掉
linux系统mysql安装
10.重启服务 service mysql restart

11.再次登陆数据库mysql -uroot -pok

12.重置密码 set password=password(‘ok’);

13.进入mysql库:use mysql

14.对root用户赋权:
grant all on . to ‘root’@’%’ identified by ‘ok’;
flush privileges;