how to create new user for phpmyadmin login

PHPMyAdmin and MySQL server complement each other very well. In most situations you have installed mysql server and phpmyadmin.

By default the mysql root password is blank and this is a big security issue and you have change the mysql password as soon as possible. If that is not done anybody could login with phpmyadmin with username root and password blank. You also must avoid to login phpmyadmin with mysql root password. Instead you must create a new user (to phpmyadmin) with same privileges as mysql root.

First change the mysql root password

mysql > update user set password=password('XXXXX') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql > FLUSH PRIVILEGES;

Thats all! you have changed your mysql root password. All you have to do is login to phpmyadmin with username as root and password as new password.

Create a new phpmyadmin user

Now we will create a new administrator login (say sysadmin) for phpmyadmin which will have same privileges as mysql root.
Its just one line command;

mysql> GRANT ALL ON *.* TO 'sysadmin'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

then

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

Now you can login to phpmyadmin as new administrator and avoid using root logins. You can create databases, change or insert or edit tables or do whatever you want!

Similar Posts:

Tags:

Balakrishnan Prabhu

Mr. Balakrishnan Prabhu is the founder of Corpocrat magazine. He is also the founder of Best Citizenships (BC), assisting wealthy individuals with Global citizenship solutions. His other interests are Linux, Machine learning, Wordpress, etc. You can contact him here

  • http://tamasys.endoftheinternet.org Tamesis Lucien

    Thanks for this – it was very useful to a noob like me 😀

  • amir

    login with root and password(what so ever) click the privileges tab, click the add new user,
    fill the user name, host password,
    select the privileges which do you want to grant. click the go button, so logout, and login with new user and password.

  • Fenix

    Amir,
    Sorry this does not work. At least in LAMP it does not work. You can create the new user, and grant all priviledges, but it won’t login.

  • http://www.gosymbian.com Domi

    Hi,

    sorry, this doesn’t work for me too, I can create the user & setup de privilege (I get a Query OK) but I can’t logging with the new user.

    Domi.

  • kevinbeckett

    Yes I love you.
    I installed Zend Server with MySQL and phpMyAdmin, after fumbling the installation of MySQL I COULD NOT log into phpMyAdmin at all. Creating sysadmin user (in the “MySQL Command Line Client”) opened the door to phpMyAdmin. Thank you!

  • azdrian

    You’re PHP superhero thks appreciate it

  • http://geeklab.se Jesus

    Nice man, I’m new in the linux world and after install mysql I wasn’t able to enter as admin, this info put my on track. Thanks.

  • Rakesh

    thanks a ton !!!!!!!!!!!!!!!!!!!!!!!!!!!!
    u guys are so kind to newbies ,thanks for sharing it..
    knowledges makes man…….

  • Ashish garg

    may i know where to write this query to setup a password for user root…????

  • samir khan

    i am trying to creat password of database in MYSQL. i gave this command
    mysql > update user set password=password(‘XXXXX’) where user=’root’;
    but it gives error 1046

  • samir khan

    i am trying to creat password of database in MYSQL. i gave this command
    mysql > update user set password=password(‘XXXXX’) where user=’root’;
    but it gives error 1046: No database selected

  • Mehere Jan

    i am trying to creat password of database in MYSQL. i gave this command
    mysql > update user set password=password(‘XXXXX’) where user=’root’;
    but it gives error 1046: No database selected
    Please help me

    • http://www.best-php-scripts.com pbu

      before running this command use

      select dbname