Hello Developers, Today i am working on AWS, I need a database for my project. I think Why use Amazon RDS why not install mysql server on my ubuntu 20.04 system.
So in this post i will guide how we can install mysql on Ubuntu 20.04
Default Ubuntu repositories have MySQL 8.0. Which can be installed directly using the package manager without adding third-party PPA.
Use the below command to install from ubuntu repositories
$ sudo apt-get install mysql-server
Press ‘Y’ for any confirmation asked by the terminal.
Now your installation of mysql server is done. Its time to set password , users and access for your mysql server.
$ sudo mysql_secure_installation
Mysql securing wizard will be opened.
- Press ‘y’ to enable validate password plugin. This will allow you to set a strict password policy for user accounts.
VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No: y
- Chose the password complexity level. Read the all 3 options and choose one:
LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
- Enter a new password and re-enter it. Make sure it matches the complexity level as described above.
Press ‘y’ to continue with provided password.New password: *********** Re-enter new password: ***********
- Press ‘y’ to continue with provided password.
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
- Remove default anonymous users from MySQL server:
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
- Disable root login from remote systems
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
- Remove test database form MySQL created by default during installation.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Reload all privileges to apply above changes immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Now our mysql us secured and we will test this my connecting to mysql, use below command to connect with mysql
$ sudo mysql
Hope your mysql will connect.
also you can test you installed mysql version my using below command.
$ mysql -V
Thanks and Happy Coding.