跳到主要内容

MariaDB

系统:Debian GNU/Linux 12 (bookworm) x86_64

安装

sudo apt install mariadb-server -y

配置

sudo mysql_secure_installation

创建新用户

进入 mariadb shell:

sudo mariadb

创建新用户:

GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

如果需要远程登陆,将 localhost 改为 %

开启远程访问

/etc/mysql/my.cnf 的末尾添加:

/etc/mysql/my.cnf
[mysqld]
skip-networking=0
skip-bind-address

接着重启服务:

sudo systemctl restart mariadb

参考

https://mariadb.com/kb/en/configuring-mariadb-for-remote-client-access/