很遗憾,我并未正常在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;
发表回复