skip to Main Content
  1. I went to Cpanel, and from there created a user and a database with the option MySQL Databases in Cpanel.
  2. I inserted and created tables without any problem.
  3. Now when I want to connect to it, with these parameters:

    $servername = “127.0.0.1”;
    $username = “aa”;
    $password = “aa”;
    $dbname = “bb”;

It says : Access denied for user ‘aa’@’localhost’ to database ‘bb’. even though I’ve created the user with the option MySQL Databases in Cpanel.

  1. I have to tell that I don’t see some options like, User Accounts, in phpmyadmin on my server. I tried some options, for example seeing users available (SELECT User…..), but It gave me an error to, because that user didn’t have privileges.

I have all kinds of access problems.

2

Answers


  1. Creating a new User in cpanel with the option to have MySQL databases doesn’t necessarily create the database user itself. Make sure you use the MySQL Database Wizard in CPanel to set up your users.

    Login or Signup to reply.
  2. If you run the mysql server in the same server your application is in, settings should be

    $servername = "localhost";
    $username = "aa";
    $password = "aa";
    $dbname = "bb"; 
    

    also create the user and grant privileges to the user

    CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
    FLUSH PRIVILEGES;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search