Installing MySQL on CentOS

First thing you need to do is make sure the binaries are installed using yum. Note that this will only install MySQL and that you may need to run it as root depending on your systems permissions.

[korey@localhost ~]$ yum install mysql-server mysql

The next thing is start MySQL:

[korey@localhost ~]$ service mysqld start

Once you start the service, it will give you some instructions for having it start automatically on reboot, and how to secure it.
Finally, secure MySQL, by setting a password for the root user and removing the anonymous user. Just make sure you use the same password for the first two statements below, otherwise you’ll end up scratching your head as to why you cannot login sometimes.

[korey@localhost ~]$ mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('****');
mysql> SET PASSWORD FOR 'root'@'localhost.localdomain' = PASSWORD('****');
mysql> DROP USER ''@'localhost.localdomain';
mysql> DROP USER ''@'localhost';

Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *