Server Topic
   >  Introduction to Webservers
   >  Installing the Webserver
   >  Controlling the Webserver
   >  Installing PHP Support
   >  Using PHP
   >  Installing mySQL Database
   >  Using mySQL


Installing mySQL under Ubuntu Linux

What is mySQL?

A database is a program which stores data in a manner that allows easy management and retrieval. They are often used to store dynamic content (-i.e. data that changes frequently) and often websites will form a page by reading information from a database using a scripting language like PHP into an HTML template.

mySQL is a fully featured relational database. It is free to non-commercial users (-who do not need the support and corporate features) and so is a de-facto standard for web users on many platforms, not just Linux.

Installing mySQL under Ubuntu Linux

The mySQL database can be installed from the command line with a single command:

sudo apt-get install mysql-server

Note: if this fails, try it again after running sudo apt-get update

During installation, you will be asked to enter a password for the SQL "root" user (-this is different from the Linux "root" user, so enter a different password):

Enter the mySQL root password

Re-enter the password as a confirmation:

Re-enter the mySQL root password

Once installed, that is it! You just need to create your users and databases!

Installing mySQL under Fedora Linux

The mySQL database engine can be installed from the command line with the following command:

$ sudo yum install mysql mysql-server

mySQL should then be configured as a service and started using the following commands:

 $ sudo chkconfig --levels 235 mysqld on
$ sudo service mysqld start

Note: if the mysqld service fails to start, then you can use:

$ sudo /etc/init.d/mysqld start

Finally, you will need to perform some basic configuration, to close any possibly security holes, by setting a default password and disabling any unwanted functionality. To do this, type:

$ sudo mysql_secure_installation

For example:

$ sudo mysql_secure_installation


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): 
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] Y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

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
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

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] Y
 ... Success!

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] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

mySQL should then be configured as a service and be running.

References and Further Reading:

HomeSite IndexDesktop GuideServer GuideHints and TipsHardware CornerVideo SectionContact Us

 sitelock verified Firefox Download Button