001 MySQL 安装连接等

第一节:安装 连接 优化

1 安装: 参照阿里云官方 https://developer.aliyun.com/mirror/mariadb

CentOS7系列
cat >>/etc/yum.repos.d/MariaDB.repo<<EOF
[mariadb]
[mariadb]
name = MariaDB
baseurl = https://mirrors.aliyun.com/mariadb/yum/10.8/centos7-amd64
gpgkey=https://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1

EOF

yum makecache all
yum install MariaDB-server MariaDB-client -y
systemctl start mariadb 
systemctl enable mariadb 


下载 rpm包  https://dev.mysql.com/downloads/file/?id=484922
rpm -ivh  安装
yum install -y mysql-community-server
systemctl  start mysqld
systemctl  enable mysqld

2 安全初始化

https://mariadb.com/kb/en/mariadb-installation-version-10121-via-rpms-on-centos-7/
# 安装连接
https://mariadb.com/kb/en/mysql_secure_installation/
# 安全初始化链接 

MariaDB starting with 10.4.6
From MariaDB 10.4.6, mariadb-secure-installation is a symlink to mysql_secure_installation.

MariaDB starting with 10.5.2
From MariaDB 10.5.2, mysql_secure_installation is the symlink, and mariadb-secure-installation the binary name.



初始化项参考
https://blog.csdn.net/jinwufeiyang/article/details/119279236

3 远程连接

# mysql 和 mariadb 稍微有点区别 ,无非就是就是那几步,从软件到系统到网络依次展开

 - 软件用户   配置用户主机项允许其他主机访问  grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
             确认信息,或者刷新一下,       flush privileges ;
             # with grant option # 表示 这个用户也可以给其他用户授权,注意一下权限的严谨性。
            开启远程主机连接
            grant all privileges on *.* to root@'%' identified by 'root';
            flush privileges ;           


 - 软件本身配置 bind-address   ,允许其他ip访问, 监听 bind-address= 0.0.0.0  
 - 软件本身配置 skip-networking选项  ,关闭禁止网络访问的
 
 - 系统   防火墙放行默认端口3306 
 - 安全组策略  放行默认策略  tcp/3306
 
 - 客户端 防火墙入站出站规则 放行或者关闭
posted @ 2022-12-07 13:10  mmszxc  阅读(17)  评论(0)    收藏  举报