Problem in connecting to database (4 posts)

  1. fawad0179
    Posted 4 years ago #


    I have a problem with connecting to database I have configured wp-config.php with the following detail.

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'minhaj');

    /** MySQL database username */
    define('DB_USER', 'Rohail');

    /** MySQL database password */
    define('DB_PASSWORD', '');

    /** MySQL hostname */
    define('DB_HOST', 'localhost');

    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');

    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');

    Now it is giving me the error message which is

    Can’t select database

    We were able to connect to the database server (which means your username and password is okay) but not able to select the minhaj database.
    •Are you sure it exists?
    •Does the user Rohail have permission to use the minhaj database?
    •On some systems the name of your database is prefixed with your username, so it would be like username_minhaj. Could that be the problem?

    I have also tried that with the administrator user name.
    Can anyone help me in this regard?

    Fawad Munir

  2. Nikki Blight
    Posted 4 years ago #

    Did you create a database called "minhaj" in mySQL?

    Did you also create a user called "Rohail" in mySQL?

    Did you double check whether or not your host adds a prefix to database names?

    Did you make sure that you're using the same capitalization in your wp-config.php file as you did when you created the user?

    Does your host allow mySQL users to access a database with no password?

    Did you grant permission to access the "minhaj" database to the "Rohail" user?

  3. fawad0179
    Posted 4 years ago #

    Actually I am using webpress for the first time. Thats why I need some detail help but according to your above answer I am giving you response in points.

    1: I have minhaj database.
    2: I have no user name I have tried also with administrator.
    3: There is no prefix.
    4: it is ok.
    5: I am using my own computer as a webserver so using local host.
    6: How can I grant permission to access the inhaj database to any User?

  4. Nikki Blight
    Posted 4 years ago #

    It sounds like you haven't to created a user within mySQL. In order for wordpress to access the database, it needs a username to access it with. The easiest way to create one is via the priviledges tab in phpMyAdmin, if you have it installed (and if you don't, I highly recommend it. It's free.).

    Is "administrator" an actual mySQL account on your setup, or are you just using it because you didn't know what else to try? Typically, the default mySQL user is "root", not "administrator".

Topic Closed

This topic has been closed to new replies.

About this Topic