Hosting » DigitalOcean » How install MySQL in Ubuntu 18.04 using terminal DigitalOcean?

How install MySQL in Ubuntu 18.04 using terminal DigitalOcean?

Last updated on December 17, 2022 @ 1:49 pm

How to install MySQL on Ubuntu 18.04 using terminal?

If you’re looking to install MySQL on Ubuntu 18.04 using a terminal, you can use the following steps:

1. First, add the MySQL repository to your system.

2. To do this, open a terminal and type the following:

sudo add-apt-repository ppa:mysql/mysql

3. Once the repository has been added, update your package index using the following command:

sudo apt-get update

4. Next, install MySQL using the following command:

sudo apt-get install mysql-server

5. Once the installation has completed, you’ll need to configure the server.

6. To do this, open the MySQL server configuration file using the following command:

sudo nano /etc/mysql/my.cnf

7. Near the bottom of the file, you’ll need to add the following line:

PRO TIP: MySQL is a database management system. It is a free and open source software. The latest version is 8.0.17 sudo systemctl start mysql

8. To install MySQL in Ubuntu 18.04 using terminal Digitalocean, you will need to have root access or use sudo.

9. You can install MySQL 8.0 by using the apt repository.

First, update the apt repository:

sudo apt update

10. Then, install MySQL 8.0:

sudo apt install mysql-server-8.0

11. During the installation process, you will be prompted to set a password for the MySQL root user. After the installation is complete, start the MySQL service and enable it to start automatically at boot time:

bind-address=127.0.0.1.

Next, you’ll need to create a user account for MySQL. To do this, open the MySQL user account configuration file using the following command:

user=mysql

Finally, you’ll need to set the permissions for the MySQL server. To do this, open the MySQL server configuration file using the following command:

bind- permission = 0777

Once the permissions have been set, you can restart the MySQL server using the following command:

sudo service mysql restart

And that’s it! You now have a working MySQL server installed on your Ubuntu 18.04 system.

Morgan Bash

Morgan Bash

Technology enthusiast and Co-Founder of Women Coders SF.