安装mysql
sudo apt-get update
sudo apt-get install mysql-server
使mysql可以远程登陆
sudo ufw allow mysql
开启服务
systemctl start mysql
使他每次开机重启,都会自启动
systemctl enable mysql
PS: 出现2003的问题,则在root模式下,不然会报错,然后把bind-address = 127.0.0.1:注释掉 insert #
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf 使用vim编辑它
insert插入模式,插入#,esc普通模式,输入大写ZZ即可正常退出vim
mysql授予远程登陆权限,超级用户
mysql -uroot -p你的密码
grant all on *.* to root@'%' identified by '你的密码' with grant option;
flush privileges;
服务重启
service mysql restart
完成!
参考了:
https://support.rackspace.com/how-to/installing-mysql-server-on-ubuntu/
https://blog.youkuaiyun.com/xiangwanpeng/article/details/54562362
本文详细介绍在Ubuntu系统中安装MySQL服务器的过程,并提供使MySQL支持远程连接的配置步骤,包括修改配置文件、设置防火墙、授予远程登录权限及重启服务等关键操作。
1331

被折叠的 条评论
为什么被折叠?



