0
点赞
收藏
分享

微信扫一扫

ubuntu 21.10 安装(apt-get)mysql并配置

花姐的职场人生 2022-01-31 阅读 42

一、安装mysql

1.1 更新源

sudo apt-get update

1.2 安装mysql服务

sudo apt-get install mysql-server

二、设置root密码

sudo mysql -uroot
use mysql;

alter user 'root'@'localhost' identified with mysql_native_password by '123456';

三、设置root远程访问

3.1 修改数据库

sudo mysql -uroot
use mysql;

update user set host="%" where user="root";

flush privileges;

exit  #退出

3.2 修改配置文件

vim /etc/mysql/mysql.conf.d/mysqld.cnf

修改bind-address,并保存(Esc > :wq)

bind-address = *

3.3 重启服务

service mysql restart

3.4 测试

举报

相关推荐

0 条评论