linux系统mysql安装教程
时间: 2023-09-23 17:07:12 浏览: 120
Sure! Here's a step-by-step guide to installing MySQL on a Linux system:
1. Update the package index:
```
sudo apt update
```
2. Install MySQL server:
```
sudo apt install mysql-server
```
3. During the installation, you will be prompted to set a password for the MySQL root user. Choose a strong password and remember it.
4. Once the installation is complete, start the MySQL service:
```
sudo systemctl start mysql
```
5. (Optional) To enable MySQL to start automatically on system boot, run:
```
sudo systemctl enable mysql
```
6. To enhance the security of your MySQL installation, run the security script provided by MySQL:
```
sudo mysql_secure_installation
```
This script will prompt you to configure some security options, including removing anonymous users, disallowing root login remotely, and removing test databases. Follow the instructions and choose the appropriate options.
7. You can now access the MySQL shell by running:
```
sudo mysql -u root -p
```
Enter the MySQL root password you set earlier when prompted.
That's it! You have successfully installed MySQL on your Linux system.
阅读全文