centos7.9搭建mysql5.6
mysql5.6
官网下载软件包后上传
基于centos7.9搭建mysql5.6.42
[root@mysql02 ~]# ls
anaconda-ks.cfg init.sh MySQL-5.6.42-1.el7.x86_64.rpm-bundle.tar
解压
tar -xf MySQL-5.6.42-1.el7.x86_64.rpm-bundle.tar -C /opt/
[root@mysql02 ~]# ls /opt/
MySQL-client-5.6.42-1.el7.x86_64.rpm MySQL-server-5.6.42-1.el7.x86_64.rpm MySQL-test-5.6.42-1.el7.x86_64.rpm
MySQL-devel-5.6.42-1.el7.x86_64.rpm MySQL-shared-5.6.42-1.el7.x86_64.rpm
MySQL-embedded-5.6.42-1.el7.x86_64.rpm MySQL-shared-compat-5.6.42-1.el7.x86_64.rpm
使用yum进行安装,注意搭配centos源
[root@mysql02 ~]# yum clean all;yum repolist
Loaded plugins: fastestmirror
Cleaning repos: c
Cleaning up list of fastest mirrors
Loaded plugins: fastestmirror
Determining fastest mirrors
c | 3.6 kB 00:00:00
(1/2): c/group_gz | 153 kB 00:00:00
(2/2): c/primary_db | 3.3 MB 00:00:00
repo id repo name status
c c 4,070
repolist: 4,070
[root@mysql02 ~]#
yum install -y /opt/*
配置my.cnf,并且需要跳过验证,设置密码
sudo touch > /etc/my.cnf <eof
[mysqld]
lower_case_table_names = 1
skip-grant-tables
eof
sudo chmod 644 /etc/my.cnf
启动mysql
service mysql restart
mysql -uroot -p
密码自行修改
USE mysql;
UPDATE user SET authentication_string=PASSWORD('000000') WHERE User='root';
SET PASSWORD = PASSWORD('000000');
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '000000' WITH GRANT OPTION;
FLUSH PRIVILEGES;
关闭防火墙和selinux
setenforce 0
systemctl stop firewalld
即可测试远程访问
PS C:\Users\huhy> mysql -h 192.168.200.80 -uroot -p000000
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.42 MySQL Community Server (GPL)
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>