Files
chill_notes/数据库/MariaDB/MariaDB_Centos7安装mariadb,支持远程访问.md
2026-04-21 20:39:08 +08:00

25 lines
1.6 KiB
Markdown
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
1、安装MariaDByum -y install mariadb mariadb-server
2、设置开机启动systemctl enable mariadb
3、启动MariaDBsystemctl start mariadb
4、初始化配置mysql_secure_installation
       4.1、设置密码,会提示先输入密码
Enter current password for root (enter for none):<–初次运行直接回车
Set root password? [Y/n] < 是否设置root用户密码输入y并回车或直接回车
             New password: < 设置root用户的密码
             Re-enter new password: < 再输入一次你设置的密码
       4.2、其他配置
Remove anonymous users? [Y/n] < 是否删除匿名用户,回车
Disallow root login remotely? [Y/n] <是否禁止root远程登录,回车,
Remove test database and access to it? [Y/n] < 是否删除test数据库回车
Reload privilege tables now? [Y/n] < 是否重新加载权限表,回车
初始化MariaDB完成接下来测试登录
mysql -uroot -p你的密码
完成。
==5、设置远程登录==
      ==使用mysql -uroot -p密码登录后执行命令==
      ==GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码的明文' WITH GRANT OPTION;==
      ==FLUSH PRIVILEGES;==
==6、如果远程访问并且数据量很大则需要进行如下配置否则会出现==**MySQL server has gone away** ==的==
 ==错误     ==
   ==set global max_allowed_packet=1024*1024*16;==
> 来自 <[https://blog.csdn.net/lianshaohua/article/details/88380898](https://blog.csdn.net/lianshaohua/article/details/88380898)>