Step 1: Update Your Package Index
Open your terminal and update the package index to ensure you have the latest information on available packages using the following command
Step 2: Install MySQL Server
Install the MySQL Server package using the following command:
sudo apt install mysql-server
Step 3: Secure MySQL Installation
Once the installation is complete, it's recommended to run a security script that comes with MySQL. This will help you configure security settings.
You will be prompted to configure several options:
- Set a root password (if not already set).
- Remove anonymous users.
- Disallow root login remotely.
- Remove the test database.
- Reload privilege tables.
Follow the prompts according to your preferences.
Step 4: Start and Enable MySQL Service
Ensure that the MySQL service is running and enable it to start on boot:
sudo systemctl start mysql
sudo systemctl enable mysql
Step 5: Verify MySQL Installation
You can check the status of MySQL to confirm it’s running:
sudo systemctl status mysql
Step 6: Access MySQL
To access the MySQL shell, use the following command:
sudo mysql -u root -p
Enter the root password you set during the secure installation process.
Optional: Install MySQL Workbench
If you prefer a graphical interface, you can install MySQL Workbench:
sudo apt install mysql-workbench
You now have MySQL Server installed and running on your Ubuntu system

0 Comments