Friday, December 28, 2007

mysql easy security.

Set password for root,
mysqladmin password
Put in /etc/my.cnf (chmod 600), so it's convenient for admin, it's not a good practice, though.
[client]
user=root
password=newpasswd
For individual database, grant rights to its owner,
grant all on database1.* to 'user1'@'%' identified by 'password';
flush privileges;
If you did not record down password for root and forgot it, start mysqld with --skip-grant-tables

run "mysql mysql" with following statement,
UPDATE user SET Password=PASSWORD('YOUR_PASSWORD')
WHERE Host='localhost' AND User='root';
exit
The restart mysqld normally.





Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?