Blog

MySQL 5.5.11 Setting Security

Blog,Website Development 1 Comment

If you’re coming from the installation tutorial, congratulations! I’m glad that you made it this far. It took me three days to figure that out myself.

Restarting MySQL Without Permissions Table

The first step to setting your administrative password is to shutdown MySQL, because we have to restart it without the ACL loading.

$ /etc/init.d/mysql stop

Alright, so now restart MySQL using this command in order to ignore the permissions system.

$ /usr/local/mysql/bin/mysqld_safe --skip-grant-tables &

Setting your Passwords

There’s a couple ways to reset your password, this is just one way.

$ mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

You can’t just use restart at this point, you’ll need to stop mysql first and then start it.

$ /etc/init.d/mysql stop
$ /etc/init.d/mysql start

Now you can load mysql and test it out.

$ mysql -u root -p

Share this

About the Author

Written by Jonathon

My name is Jonathon Byrd, I'm a Apache, PHP, MySql and Javascript expert. Although I invest a considerable amount of time in these languages, I also enjoy researching other areas in order broaden my knowledge and understanding of programming and development.

1 Comment to "MySQL 5.5.11 Setting Security"

  1. Thoufiq

    May 4, 2011

    Hello Jon,
    Thanks for your valuable tutorial, it helped me a lot to upgrade from mysql5.1 to mysql5.5. I was stuck in this process for 1 week. Really, your tutorial is nice and millions of thanks to u. But i have still one error that when giving command mysql_upgrade, it shows like this

    root@dhcppc4:~# mysql_upgrade
    Looking for 'mysql' as: mysql
    Looking for 'mysqlcheck' as: mysqlcheck
    Running 'mysqlcheck' with connection arguments: '–port=3306' '–socket=/var/run/mysqld/mysqld.sock'
    Running 'mysqlcheck' with connection arguments: '–port=3306' '–socket=/var/run/mysqld/mysqld.sock'
    Running 'mysql_fix_privilage_tables'…
    ERROR 1044 (42000): Access denied for user ''@' localhost to database 'mysql'
    FATAL ERROR: Upgrade failed

    But it is going in mysql root and have access to create new databases, this error is only when giving mysql_upgrade. Also, i have searched related to this error but they are all useless.

    Can you help me to resolve this error..

    Reply

Leave a Comment