To install MySQL on Centos is a little different from Ubuntu – as I found out. Obviously APT is replaced with yum on this flavour of Linux, but not only that, yum doesn’t appear to set it up for you after installing it (with root account, etc).
Step 1, Install MySQL
> yum install mysql-server mysql
This will download the files and install them in the correct folders, as apptitude would. Step 2 shows you how to prepare the MySQL service.
Step 2, Configure the service
Tell the system to start the MySQL Daemon upon startup:
chkconfig --levels 235 mysqld on service mysqld start
Now MySQL is installed and running, but the root account will have no password, so we need to ensure there is a strong one. (Or not if you are a crazy one) – You will get some message when the service starts for the first time related to security measures, I would suggest you do read it.
Step 3, Set up Root user
> mysql -u root > SET PASSWORD FOR 'root'@'%' = PASSWORD(<password>);
Replace <password> with your desired password.
Obviously change the root user details based on your particular set up. I.e. where the root account can connect from, which servers, ips, etc.