skip to Main Content

I created my database offline using XAMPP. After uploading my site, I imported my database into server PHPmyadmin. Yet when if i load my website it will deny me access to the database displaying this error message:

Failed to connect to MySQL: Access denied for user
‘everjoe’@’localhost’ (using password: YES)

4

Answers


  1. mysql -uroot -p
    
    CREATE USER 'username'@'%' IDENTIFIED BY 'password';
    
    CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
    
    GRANT ALL ON database_name.* TO 'username'@'%';
    
    Login or Signup to reply.
  2. So could you check, if your Server of the Website is allowed in the SQL-Server, you can check that on the sql-console with the following command.

    SELECT Host, User FROM mysql.user;
    

    See here https://mariadb.com/kb/en/create-user/#host-name-component for detailed information.

    If there is still a Problem, maybe it is your /etc/mysql/my.cnf-File
    See here: MySQL Error: : 'Access denied for user 'root'@'localhost'

    Login or Signup to reply.
  3. The problem here is incorrect username and password, check your username and password details again

    You could also go to c:xamppphpmyadminconfig.inc.php

    Check for
    $cfg['Servers'][$i]['user'] and $cfg['Servers'][$i]['password']

    You should see your phpmyadmin username and password.

    Login or Signup to reply.
  4. This means that the user has no access. This can be fixed in the following ways

    insert into mysql.user (Host, User, Password) VALUES ('%', 'root', password('setyourpasswordhere'));
    GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION;
    

    or if you are using SQL workbench, you can create an user under

    Adminstration --> users and previlages --> click on Add account button and create a new user, with hosts as **%** and grant the previlages in Adminstrative roles, schema previalges tabs.
    

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search