设为首页收藏本站

安徽论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 11176|回复: 0

Ubuntu 18.04.4安装mysql的过程详解 亲测可用

[复制链接]

110

主题

0

回帖

342

积分

中级会员

Rank: 3Rank: 3

积分
342
发表于 2022-3-26 10:59:07 | 显示全部楼层 |阅读模式
网站内容均来自网络,本站只提供信息平台,如有侵权请联系删除,谢谢!
下面看下Ubuntu 18.04.4安装mysql的过程,内容如下所示:
  1. 1 sudo apt-get update
复制代码
  1. 2 sudo apt-get install mysql-server
复制代码
  1. 3 sudo mysql_secure_installation # 初始化配置
  2. #1
  3. VALIDATE PASSWORD PLUGIN can be used to test passwords...
  4. Press y|Y for Yes, any other key for No: N (我的选项)
  5. #2
  6. Please set the password for root here...
  7. New password: (输入密码)
  8. Re-enter new password: (重复输入)
  9. #3
  10. By default, a MySQL installation has an anonymous user,
  11. allowing anyone to log into MySQL without having to have
  12. a user account created for them...
  13. Remove anonymous users? (Press y|Y for Yes, any other key for No) : N (我的选项)
  14. #4
  15. Normally, root should only be allowed to connect from
  16. 'localhost'. This ensures that someone cannot guess at
  17. the root password from the network...
  18. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y (我的选项)
  19. #5
  20. By default, MySQL comes with a database named 'test' that
  21. anyone can access...
  22. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N (我的选项)
  23. #6
  24. Reloading the privilege tables will ensure that all changes
  25. made so far will take effect immediately.
  26. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y (我的选项)
  27. 4 systemctl status mysql.service # 检查服务器状态
复制代码
  1. 4 systemctl status mysql.service # 检查服务器状态
复制代码
running代表无问题
  1. 5 修改mysql 端口号以及将监听地址改为所有

  2. vim /etc/mysql/mysql.conf.d/mysqld.cnf # 编辑配置文件
  3. bind-address            = 0.0.0.0  #将监听ip修改为所有
  4. port            = 3388  # 监听端口修改为3388,可以不改我这是为了安全
  5. 修改完毕之后重启服务
  6. systemctl restart mysql.service
复制代码
  1. 6 开放mysql远程访问
  2. 1 登录数据库
  3. mysql -u root -p

  4. 2 切换到数据库mysql
  5. use mysql
  6. 3 删除匿名用户
  7. delete from user where user='';
  8. 4 增加允许远程访问的用户或者允许现有用户的远程访问
  9. 给root授予在任意主机(%)访问任意数据库的所有权限
  10. mysql> grant all privileges on *.* to 'root'@'%' identified by '这里替换成你想要设置的密码' with grant option;
  11. flush privileges;
  12. 5 退出数据库
  13. mysql> exit
  14. 6 重启数据库
  15. sudo service mysql restart
复制代码
到此这篇关于Ubuntu 18.04.4安装mysql的过程详解 亲测可用的文章就介绍到这了,更多相关Ubuntu 18.04.4安装mysql内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
                                                        
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
免责声明
1. 本论坛所提供的信息均来自网络,本网站只提供平台服务,所有账号发表的言论与本网站无关。
2. 其他单位或个人在使用、转载或引用本文时,必须事先获得该帖子作者和本人的同意。
3. 本帖部分内容转载自其他媒体,但并不代表本人赞同其观点和对其真实性负责。
4. 如有侵权,请立即联系,本网站将及时删除相关内容。
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表