So if you have been following along with the past several articles you will have gone through the steps of Installing Fedora Linux, Configuring Fedora Linux, Installing Apache and getting it to work. And by now you should be able to view plain HTML websites. If you still can’t view plain HTML websites, please don’t go ahead just yet.
Now I will be assuming everything from earlier is working correctly. And you are ready to install MySQL on your server. So to do this we can once again use YUM. So we will issue the following commands.
yum install mysql mysql-server -y
This will install MySQL and MySQL Server. Now MySQL uses Port 3306. Which is usually blocked by our routers and firewalls. However isn’t usually listed. So first we will unblock Port 3306 in our firewall. To do this we will type the following commands.
Now we can see our servers Firewall. You know the ugly blue screen with red buttons we saw in the last post. Once here we will use our Tab key to navigate to highlight the Customize Now button. Then we will hit the Enter key. Now we will use our Tab key to navigate to the Forward button. Once it is Highlighted, we will hit Enter. This will bring us up to screen where we can add extra ports we didn’t see in the list earlier.
We will use our arrow keys to navigate to the place that says add. Once their we will hit the Enter key. Now where it says Port/Port-Range we will type 3306. And where it ask for the protocal we will type tcp. Then we will hit Enter. Then we will get out of the Firewall.
Now it is time to make MySQL start up when the server starts up. To do this we will type the following.
chkconfig mysqld on
Now we will start MySQL to do this we will type the following commands.
systemctl start mysqld.service
Note: the /etc/init.d/start mysqld command will not work anymore no matter what.
Now that MySQL is installed and running we will have to configure it. To do this we will type the following commands.
This will output the following.
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
Since this is the first time we are setting up MySQL. We will not have a root password for the MySQL database. So we will just hit the Enter key.
Then we will get the following output.
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n]
The capital why means it is the default option. So if you just hit the Enter key it will assume you wanted to hit the Y key. So either press Enter or hit the Y key followed by hitting the Enter key. And we should see the following output.
This is where you will enter your new root password for your MySQL account. I would highly recommend that you use different password then the root password of your server. After you enter your new password hit enter. It will ask you to retype your new password to make sure you typed it correctly. After you retyped your password hit enter again. This will show you the following output.
Password updated successfully!
Reloading privilege tables..
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
Remove anonymous users? [Y/n]
Once again you can hit Enter or press the Y key followed by hitting the Enter key. Then you will see the following.
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n]
Either hit Enter or press the Y key and then hit Enter. Then you will see the following.
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n]
Either hit Enter or press the Y key followed by the Enter key. You will then see the following.
- Dropping test database...
- Removing privileges on test database...
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n]
Either hit Enter or press the Y key followed by the Enter key and you will then see the following.
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Congratulations you have now successfully setup MySQL on your Server.