linux安装mysql
时间: 2023-07-05 19:36:05 浏览: 74
linux 安装mysql
可以按照以下步骤在Linux上安装MySQL:
1. 打开终端并更新系统:
```
sudo apt-get update
sudo apt-get upgrade
```
2. 安装MySQL服务器:
```
sudo apt-get install mysql-server
```
3. 安装完成后,启动MySQL服务并设置开机自启:
```
sudo systemctl start mysql
sudo systemctl enable mysql
```
4. 进入MySQL:
```
mysql -u root -p
```
5. 创建新用户并授权:
```
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
```
6. 退出MySQL:
```
quit;
```
这样就完成了MySQL的安装和配置。
阅读全文