Installing MySQL on CentOS

Installation of MySQL server is pretty simple and straightforward with yum. We’ll first install the database, and set a root password on it.

Install MySQL Server Package

The mysql-server package will install MySQL server, along with its dependencies such as the client and client libraries.

yum install mysql-server

Set root password

The default installation from yum is password-less for the root (privileged) database user so we will want to set a password using the mysqladmin command. In this example I set the password to motorrobot, but obviously you should choose something more secure.

/usr/bin/mysqladmin -u root password 'motorrobot'