debian12 安装 mysqldb(Mariadb)

很遗憾,我并未正常在debian12上安装成功mysql,只能安装兼容版本Mariadb。。

安装Mariadb

  • su
  • apt update
  • apt install mariadb-server
  • systemctl status mariadb

初始化配置

  • mysql_secure_installation
  • 根据提示,设置一些列的初始化配置

更改Root密码

  • use mysql;
  • alter user root@localhost identified by ‘123456’; # 将密码设为123456
  • exit; # 退出系统
  • mysql -uroot -p # 使用密码登录

设置MariaDB远程访问

  • vim /etc/mysql/mariadb.conf.d/50-server.cnf # 配置文件
  • # bind-address = 127.0.0.1
  • bind-address = 0.0.0.0 #务必将bind-address的值修改为0.0.0.0

赋予远程访问权限

  • mysql -u root -p
  • grant all privileges on *.* to root@’%’ identified by ‘123456’ with grant option;
  • flush privileges;

1 条评论

  1. 木尾洞 : 2026 年 01 月 21 日 02:55

    确实少有, 这么高质量的内容。敬意。

评论*

* 为必填