目录 1. 更新系统软件包2. 安装MySQL 5.73. 启动MySQL 服务4. 设置MySQL root 密码5. 验证MySQL 安装6. 启用远程访问7. 创建新用户8. 为新用户授
以ubuntu 18.04系统为例,安装Mysql 5.7。操作步骤如下:
sudo apt update
sudo apt install mysql-server-5.7 mysql-client-5.7
sudo systemctl start mysql
sudo mysql_secure_installation
这个命令会提示你设置 root 密码,然后询问一些其他的安全设置,可以按照提示进行操作。
Press y|Y for Yes, any other key for No: n密码强度插件,系统将会在用户设置密码时执行一些密码强度检查。如果你想启用这个插件,可以按照提示按下 `y` 或 `Y` 键,然后按回车。如果你不想启用这个插件,按下任意其他键,然后按回车。
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y否要移除匿名用户
Disallow root login remotely? (Press y|Y for Yes, any other key for No) :n是否要禁止 root 用户远程登录
Remove test database and access to it? (Press y|Y for Yes, any other key for No) :y否要删除测试数据库
Reload privilege tables now? (Press y|Y for Yes, any other key for No) :y重新加载权限表
使用以下命令登录到MySQL:
sudo mysql -u root -p
打开 MySQL 的配置文件,通常位于 /etc/mysql/mysql.conf.d/mysqld.cnf
或类似的路径。你可以使用文本编辑器打开这个文件,比如:
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
找到 bind-address 行:
注释掉bind-address = 127.0.0.1
例如:
# bind-address = 127.0.0.1
在 MySQL 控制台中,执行以下命令来创建新用户:
CREATE USER 'new_user'@'%' IDENTIFIED BY 'new_passWord';
GRANT ALL PRIVILEGES ON *.* TO 'new_user'@'%' WITH GRANT OPTION;FLUSH PRIVILEGES;
#查看 MySQL 的运行状态sudo systemctl status mysql#启动sudo systemctl start mysql#重启sudo systemctl restart mysql#停止sudo systemctl stop mysql
来源地址:https://blog.csdn.net/qq233325332/article/details/132339173
--结束END--
本文标题: Ubuntu安装mysql5.7
本文链接: https://www.lsjlt.com/news/407829.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0