sudo apt-get update
sudo apt-get install mysql-server

安装完成以后,执行mysql初始化配置

sudo mysql_secure_installation

其中有一步允许root远程访问选Yes,其他随意

安装完成后查看mysql是否运行:

systemctl status mysql.service

如果之前没有允许root远程访问,可以通过本地登陆root后修改:

sudo mysql -u root -p

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

查看3306是否正常:

netstat -an | grep 3306

Ubuntu18.04安装mysql

 

 

 修改Mysql配置文件:

vim /etc/mysql/mysql.conf.d/mysqld.cnf
找到bind-address            = 127.0.0.1,前面加#注释

重启Mysql:
/etc/init.d/mysql restart

再次查看端口,正常了:

Ubuntu18.04安装mysql

 

 



相关文章:

  • 2021-12-26
  • 2021-11-21
  • 2021-05-01
  • 2022-01-25
  • 2021-10-12
猜你喜欢
  • 2022-01-15
  • 2021-08-29
  • 2022-02-27
相关资源
相似解决方案