Today, we’re going to be installing MySQL on a Ubuntu 14.04 server.
Let’s do a quick preflight check to ensure we have everything we need to get started:
- These instructions are intended for installing MySQL on a single Ubuntu 14.04 LTS node.
- I’ll be working from a Liquid Web Self Managed Ubuntu 14.04 LTS server, and I’ll be logged in as root.
Step 1: Install MySQLFirst, you’ll follow a simple best practice: ensuring the list of available packages is up to date before installing anything new.
apt-get updateInstalling MySQL is as simple as running just one command:
apt-get install mysql-server php5-mysqlYou may receive the following prompt or something similar:
After this operation, 98.2 MB of additional disk space will be used.
Do you want to continue? [Y/n]Enter Y to continue. Next, you’ll be asked: New password for the MySQL “root” user:
Step 2: Configure MySQL for UseNext, we’ll instruct MySQL to create its database directory structure:
Step 3: Secure MySQLAnd now let’s secure MySQL by removing the test databases and anonymous user created by default:
mysql_secure_installationYou’ll be prompted to enter your current password. Enter the root MySQL password set during installation: Enter current password for root (enter for none): Then, assuming you set a strong root password, go ahead and enter n at the following prompt: Change the root password? [Y/n] n Remove anonymous users, Y: Remove anonymous users? [Y/n] Y Step 4: Verify MySQL InstallationDisallow root logins remotely, Y: Disallow root login remotely? [Y/n] Y Remove test database and access to it, Y: Remove test database and access to it? [Y/n] Y And reload privilege tables, Y: Reload privilege tables now? [Y/n] Y
Step 4: Verify MySQL InstallationYou can check the version of the MySQL installation with the following command:
mysql -VEnter the MySQL command client:
mysql -pYou’ll be asked for the root password for the MySQL server, which was set earlier in this tutorial: Enter password: And then you should be greeted with the following:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 47
Server version: 5.5.40-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql>standing byExit the command line with the following command:
service mysql stopStart MySQL:
service mysql startTo check the status of MySQL:
service mysql statusRestart MySQL:
service mysql restartChoosing the right database can be daunting at times and that’s where we can step in to assist. We will be able to provide detailed info regarding MySQL to ensure you have the latest and most accurate answers possible. Should you need any assistance setting up, modifying or utilizing your database, don’t hesitate to contact Liquidweb support for more answers! You can reach us on our toll free number at 1-800-580-4985, or use our International number at 517-322-0434. You can also open a ticket with us using the firstname.lastname@example.org email or, open a ticket from your Manage interface. Lastly, there’s always our chat option if you need fast assistance on smaller issues. Whatever method you choose to reach out to us, do not hesitate to contact us if you run into any problems, as we are always on the lookout to offer our assistance and support! Thank you for hosting with Liquidweb!