6 Sept 2011

How to set or change root password in mysql server

A very important step in a database configuration, and many times forgotten, is the setup of a root password. This easy procedure will increase the security for your databases, even if you're only using a personal server on your laptop there is always a chance for an intruder to get sensible data.



In a shell we use the mysqladmin command to achieve this as follows for a local database server:
mysqladmin -u root password "the_new_password"
 Or a remote one:
mysqladmin -u root -h host_name password "the_new_password"
Next you should restart the database server, to make sure the new security settings are used.
sudo /etc/init.d/mysql restart

No comments: