美文网首页
ubuntu安装mysql server

ubuntu安装mysql server

作者: GaJiCaptain | 来源:发表于2019-11-22 18:19 被阅读0次
  1. 首先更新apt
sudo apt-get update
  1. 看看能安装的mysql版本
apt-cache search mysql | grep mysql-server
  1. 安装mysql-server,过程中需要确认安装一次,设置两次root密码
sudo apt-get install mysql-server-5.7

安装过程中需要设定两次root密码

  1. 测试安装是否成功,输入下行命令,再按照提示输入密码
mysql -u root -p
  1. 如果需要远程访问,远程授权
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION;
  1. 如果需要远程访问,就需要修改配置文件:
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

修改其中一行
bind-address=127.0.0.1

bind-address=0.0.0.0

  1. 最后重启mysql服务
sudo service mysql restart

相关文章

网友评论

      本文标题:ubuntu安装mysql server

      本文链接:https://www.haomeiwen.com/subject/mwbqwctx.html