NOTE:RUNNINGALLPARTSOFTHISSCRIPTISRECOMMENDEDFORALLMySQLSERVERSINPRODUCTIONUSE!PLEASEREADEACHSTEPCAREFULLY!
InordertologintoMySQLtosecureit,we'llneedthecurrent
passwordfortherootuser.Ifyou'vejustinstalledMySQL,and
youhaven'tsettherootpasswordyet,thepasswordwillbeblank,
soyoushouldjustpressenterhere.
Entercurrentpasswordforroot(enterfornone):
OK,successfullyusedpassword,movingon...
SettingtherootpasswordensuresthatnobodycanlogintotheMySQL
rootuserwithouttheproperauthorisation.
Setrootpassword?[Y/n]
Newpassword:
Re-enternewpassword:
Passwordupdatedsuccessfully!
Reloadingprivilegetables..
...Success!
Bydefault,aMySQLinstallationhasananonymoususer,allowinganyone
tologintoMySQLwithouthavingtohaveauseraccountcreatedfor
Thisisintendedonlyfortesting,andtomaketheinstallation
goabitsmoother.Youshouldremovethembeforemovingintoa
productionenvironment.
Removeanonymoususers?[Y/n]
...Success!
Normally,rootshouldonlybeallowedtoconnectfrom'localhost'.This
ensuresthatsomeonecannotguessattherootpasswordfromthenetwork.
Disallowrootloginremotely?[Y/n]
...Success!
Bydefault,MySQLcomeswithadatabasenamed'test'thatanyonecan
Thisisalsointendedonlyfortesting,andshouldberemoved
beforemovingintoaproductionenvironment.
Removetestdatabaseandaccesstoit?[Y/n]
-Droppingtestdatabase...
...Success!
-Removingprivilegesontestdatabase...
...Success!
Reloadingtheprivilegetableswillensurethatallchangesmadesofar
willtakeeffectimmediately.
Reloadprivilegetablesnow?[Y/n]
...Success!
Cleaningup...
Alldone!Ifyou'vecompletedalloftheabovesteps,yourMySQL
installationshouldnowbesecure.
ThanksforusingMySQL!