CentOS7离线安装MySQL的教程详解
1.删除原有的mariadb,不然mysql装不进去
mariadb-libs-5.5.52-1.el7.x86_64
rpm -qa|grep mariadb
rpm -e --nodeps mariadb-libs
直接下载mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar,所有的rpm包都在⾥⾯
rpm -ivh mysql-community-common-5.7.21-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.21-1.el7.x86_64.rpm
rpm -ivh mysql-community-devel-5.7.21-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.21-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.21-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.21-1.el7.x86_64.rpm
⾄此,mysql5.7所有⽂件安装完毕,接下来就是开启服务测试了。
1.⾸先关闭mysql服务:
service mysqld stop
2.然后修改配置⽂件:mysql下载libs包的网址
vim /etc/myf
3.接下来加⼊⼀句代码即可空密码登录mysql:
# Disabling symbolic-links is recommended to prevent assorted security risks
skip-grant-tables  #添加这句话,这时候登⼊mysql就不需要密码
symbolic-links=0
4.开启mysql服务:
service mysqld start
5.空密码登录mysql:
mysql -u root -p    #输⼊命令回车进⼊,出现输⼊密码提⽰直接回车
6.设置mysql密码:
mysql> set password for root@localhost = password('123456');
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> flush privileges; #更新权限
Query OK, 0 rows affected (0.00 sec)
mysql> set password for root@localhost = password('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql>flush privileges; #更新权限
mysql>quit; #退出
service mysqld stop # 停⽌mysql服务, 恢复mysql配置
vim /etc/myf  #修改配置⽂件
# Disabling symbolic-links is recommended to prevent assorted security risks
# skip-grant-tables # 注释掉这句话
symbolic-links=0
service mysqld start # 启动mysql服务
mysql -uroot -p # 输⼊新密码登录
7.设置mysql开机⾃启:
systemctl enable mysqld
总结
以上所述是⼩编给⼤家介绍的CentOS7离线安装MySQL的教程,希望对⼤家有所帮助,如果⼤家有任何疑问请给我留⾔,⼩编会及时回复⼤家的。在此也⾮常感谢⼤家对⽹站的⽀持!
如果你觉得本⽂对你有帮助,欢迎转载,烦请注明出处,谢谢!

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。