skip to Main Content

I am on linux and I have never installed a database management system but when I type in the terminal mysql --version I get mysql Ver 15.1 Distrib 10.1.26-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2.

I can connect to the database without a password when I type mysql without any password.

Meanwhile, I installed Adminer and I would like to use it alternatively phpmyadmin to manage my database but I can not connect myself I receive the following error in my browser Access denied for user 'root' @ 'localhost'.

I try all the methods found on google google to create a root password but I can not.

I tried the solutions proposed here:

And many oder link.

How can I set a root password for mysql to use it in Adminer

2

Answers


  1. If you have never set a root password for MySQL, the server does not require a password at all for connecting as root. To set up a root password for the first time, use the mysqladmin command at the shell prompt as follows:

    mysqladmin -u root password newpass
    
    Login or Signup to reply.
  2. I followed this Link. The initial Mysql Setup didnt work, so I did a password reset.
    Mysql Version 5.7.38:

    Warning: During this operation your anyone can access your MYSQL Server without password!

    $> sudo nano /etc/mysql/my.cnf
    
    [mysqld]          # add if not present
    skip-grant-tables # add line
    
    $> sudo mysql restart && mysql #should login with user root without password
    mysql> USE mysql;
    mysql> UPDATE user SET authentication_string=PASSWORD("YourNewPassword") WHERE user='root';
    

    The following SQL was important:

    mysql> UPDATE user set plugin="mysql_native_password" where user='root';
    
    mysql> FLUSH privileges;
    mysql> QUIT;
    
    sudo nano /etc/mysql/my.cnf
      skip-grant-tables #remove line
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search