B4J Tutorial [GCE] For Noobs, Part 6 - Installing MySQL / MariaDB

Note: some distributions of Linux are now installing MariaDB as a default. Debian 9 Stretch is an example of that. The two databases are, for the most part, identical to each other. MariaDB is a fork (a clone/copy) of MySQL that was made when Oracle took over Sun.

Note: If you are only interested in MySQL then look for the Tutorial that specifically installs MySQL.

For the remainder of this tutorial I’ll be referring to both the databases as just MySQL.

Installing MySQL is fairly simple. Again, we’re going to run some commands from the command line of the console. Follow the steps below and MySQL will be up and running afterwards.

Type the following at the command line to install MySQL Server and Client

sudo apt-get install mysql-server mysql-client

Answer ‘Y’ when you are prompted to ‘Do you want to continue?’. It takes a couple of moments to install - hopefully, you still have some coffee left over from the previous tutorial. When it’s done MySQL will be installed and running.

If you chose a different version of Linux (ie. not Debian 9 Stretch) then MySQL may have been installed and as part of the install process you would have been asked for a password for the root user.

If you chose Debian 9 then MariaDB will be installed and the default root password is blank - we will need to change this a bit later to make it more secure.

Check that MySQL is running by typing the following into the command line and then press Enter.

For Debian 9 type the following
sudo mysql​

If you were prompted for a root password during the install then type the following
sudo mysql -u root -p​

This will start the database client where you can run sql commands etc. You should see some welcome text and then a prompt that looks like

MariaDB [(none)]>
OR
mysql>

This is the MySQL Client prompt where you can type SQL commands like SELECT or DELETE etc.

If you installed Debian 9 for the OS then look for Tutorial 7 where we will change the root password.

We’re all done now so to exit from MySQL type the following and then press Enter.
quit;
 

Mashiane

Expert
Licensed User
Longtime User
sudo apt-get install mysql-server mysql-client
Hopefully I can get some help on this...

1685611159486.png
 
Top