Live Chat Software by NetForChoice |
How To Install MySQL on Ubuntu 14.04
Posted by Helpdesk System on 18 March 2016 07:11 PM
|
|
IntroductionMySQL is an open-source database management system, commonly installed as part of the popular LAMP(Linux, Apache, MySQL, PHP/Python/Perl) stack. It uses a relational database and SQL (Structured Query Language) to manage its data. The short version of the installation is simple: update your package index, install the
This tutorial will explain how to install MySQL version 5.5, 5.6, or 5.7 on a Ubuntu 14.04 server. If you want more detail on these installation instructions, or if you want to install a specific version of MySQL, read on. However, if you're looking to update an existing MySQL installation to version 5.7, you can read this MySQL 5.7 update guide instead. Step 1 — Installing MySQLThere are two ways to install MySQL. You can either use one of the versions included in the APT package repository by default (which are 5.5 and 5.6), or you can install the latest version (currently 5.7) by manually adding MySQL's repository first. If you want to install a specific version of MySQL, follow the appropriate section below. To help you decide which version is best for you, you can read MySQL's introduction to MySQL 5.5, then what's new in MySQL 5.6 and what's new in MySQL 5.7. If you're not sure, you can just use the To install MySQL this way, update the package index on your server and install the package with
You'll be prompted to create a root password during the installation. Choose a secure one and make sure you remember it, because you'll need it later. Move on to step two from here. Installing MySQL 5.5 or 5.6If you want to install MySQL 5.5 or 5.6 specifically, the process is still very straightforward. First, update the package index on your server.
Then, to install MySQL 5.5, install the
To install MySQL 5.6, install the
For both options, you'll be prompted to create a root password during the installation. Choose a secure one and make sure you remember it, because you'll need it later. Installing MySQL 5.7If you want to install MySQL 5.7, you'll need to add the newer APT package repository from the MySQL APT repository page. Click Download on the bottom right, then copy the link on the next page from No thanks, just start my download. Download the
Next, install it using
You'll see a prompt that asks you which MySQL product you want to configure. The MySQL Server option, which is highlighted, should say mysql-5.7. If it doesn't, press Once the option says mysql-5.7, scroll down on the main menu to Apply and press
Finally, install the
You'll be prompted to create a root password during the installation. Choose a secure one and make sure you remember it, because you'll need it later. Step 2 — Configuring MySQLFirst, you'll want to run the included security script. This changes some of the less secure default options for things like remote root logins and sample users.
This will prompt you for the root password you created in step one. You can press Next, we'll initialize the MySQL data directory, which is where MySQL stores its data. How you do this depends on which version of MySQL you're running. You can check your version of MySQL with the following command.
You'll see some output like this: Output
If you're using a version of MySQL earlier than 5.7.6, you should initialize the data directory by running
Note: In MySQL 5.6, you might get an error that says FATAL ERROR: Could not find my-default.cnf. If you do, copy the
This is due to some changes made in MySQL 5.6 and a minor error in the APT package.
The However, if you installed version 5.7 from the Debian distribution, like in step one, the data directory was initialized automatically, so you don't have to do anything. If you try running the command anyway, you'll see the following error: Output
Step 3 — Testing MySQLRegardless of how you installed it, MySQL should have started running automatically. To test this, check its status.
You'll see the following output (with a different PID). Output
If MySQL isn't running, you can start it with For an additional check, you can try connecting to the database using the
You should see output similar to this: Output
This means MySQL is up and running. | |
|