FreeBSD Cookbook

My notes on the principles and practices of software related issues such as compiler, assembler, graphical user interface, and operating system design. I am currently learning these topics at university and FreeBSD as UNIX operating system for study purpose.
nixCraft » FreeBSD CookBook

Securing MySQL Server - setup root password

As you see MySQL server connects without any password restriction. This is not a good idea for production environment so let us setup root password with mysqladmin command. By default MySQL server installs without any password and it use root account as admin user for managing MySQL server. Please do not get confused with FreeBSD root user account. Both are different account and password for both accounts should be different for security reasons.

$ mysqladmin -u root password MYPASSWORD

Now try to connect server:

$ mysql

Output:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
To connect to MySQL server use following syntax (when prompted for password type newly set password):

$ mysql -u root -p

Output
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 5.0.9-beta

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
Now your server is secured and no one can connect to MySQL server anonymously.
See also:
About
Your first interaction with MySQL database server

0 User Contributed Notes:

<< Home


Powered by blogger