Install MySQL on Centos/RedHat using mysql_secure_installation
1- Install mysql-server mysql-client
yuminstallmysql-server-y
2- Start mysql-server
/etc/init.d/mysqldstart
3- Setup mysql-server to start at boot time
chkconfigmysqldon
4- Setup MySQL root user password using /usr/bin/mysql_secure_installation script(i recomend this if you plan to put it in production).
/usr/bin/mysql_secure_installationEntercurrentpasswordforroot(enterfornone):OK,successfullyusedpassword,movingon...Bydefault,aMySQLinstallationhasananonymoususer,allowinganyonetologintoMySQLwithouthavingtohaveauseraccountcreatedforthem.Thisisintendedonlyfortesting,andtomaketheinstallationgoabitsmoother.Youshouldremovethembeforemovingintoaproductionenvironment.Removeanonymoususers?[Y/n]y...Success!Normally,rootshouldonlybeallowedtoconnectfrom'localhost'.Thisensuresthatsomeonecannotguessattherootpasswordfromthenetwork.Disallowrootloginremotely?[Y/n]y...Success!Bydefault,MySQLcomeswithadatabasenamed'test'thatanyonecanaccess.Thisisalsointendedonlyfortesting,andshouldberemovedbeforemovingintoaproductionenvironment.Removetestdatabaseandaccesstoit?[Y/n]y-Droppingtestdatabase......Success!-Removingprivilegesontestdatabase......Success!Reloadingtheprivilegetableswillensurethatallchangesmadesofarwilltakeeffectimmediately.Reloadprivilegetablesnow?[Y/n]y...Success!Cleaningup...Alldone!Ifyou've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!