• Resolved philtronics

    (@philtronics)


    Hi,

    I ran wp-admin/setup-config.php and filled in the information, clicked the button and it says it can’t connect to the database. But, the host (localhost), username, and password were the same as used by my aspx pages to access the database (to serve up stock charts) without issues.

    What could be the problem?

    Thanks!
    Phil

Viewing 15 replies - 1 through 15 (of 21 total)
  • Try contacting your hosts for assistance.

    Thread Starter philtronics

    (@philtronics)

    Thanks, but I am the host.

    Are you sure that you used the connection info for your MySQL db and not your Microsoft SQL Server database?

    Thread Starter philtronics

    (@philtronics)

    Yes, extremely sure. I built this huge web site using MySQL but I don’t even have the MS version installed. It’s very puzzling.

    Can you connect to the DB using phpMyAdmin? Sounds like you can but double check just to be 100% sure. If yes then quadruple check config.php – in fact delete the info a retype. Not uncommon to check the info multiple times and be staring at it so hard you don’t see the tiny typo that breaks it.

    Thread Starter philtronics

    (@philtronics)

    Don’t have phpMyAdmin, I can access MySQL from the command line using \\MySQL Server 4.1\bin\mysql –user=root –password=*********, or access it programatically. I cut and pasted the from my C# program where it works fine, into the wp-config.php file – I guess this is what you’re referring to – but no luck!

    Thread Starter philtronics

    (@philtronics)

    Well, this gets more interesting. I can get it to log on from a command window with “mysqladmin variables -u root -p”. It prompts me for the password, then dumps the status.

    It looks like you have the same issue I had. Depending on your version of WP that you installed, one installs almost seemlessly, another requires a bit more MySQL work. In the latter case, you have to add the wordpress database and the user to MySQL directly.

    So, in the wp-config.php file, you have
    ———————–
    /** The name of the database for WordPress */
    define(‘DB_NAME’, ‘wordpress’);

    /** MySQL database username */
    define(‘DB_USER’, ‘wordpress’);

    /** MySQL database password */
    define(‘DB_PASSWORD’, ‘shhhhh’);
    (change this to suit your needs)

    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);
    ———————————————–

    Then, as root, execute ‘mysql’
    You should be presented with a prompt of
    mysql>
    At that point, execute the following lines
    mysql> create database ‘wordpress’;
    mysql> create user ‘wordpress’@’localhost’ identified by ‘shhh’;
    mysql> grant all on wordpress.* to ‘wordpress’@’%’ ;

    Again, I suggest using a password of your own creation, as long as it matches above. Once you get it up and running, change the priviliges to match your needs. You can restrict it until it quits then back off to get it working again.

    Good luck and good blogging ??
    Otto

    Thread Starter philtronics

    (@philtronics)

    Well, now we’re starting to get somewhere. I had already created the wordpress database, but didn’t realize it needed a different user. I’m running MySQL 4.something, so it doesn’t take the Create User command. Therefore I tried the following: GRANT ALL PRIVILEGES ON wordpress TO ‘wordpress’@’localhost’IDENTIFIED BY ‘******etc’ WITH GRANT OPTION. Now it works better, the error message is Can’t Select Database, which means the user and pw are ok. It says to be sure the wordpress database exists, but it already does exist. From the mysql prompt I can Use wordpress and it says Database Changed.

    Next I tried a second command with the wildcard, i.e., GRANT ALL PRIVILEGES ON wordpress TO ‘wordpress’@’%’IDENTIFIED BY ‘******etc’ WITH GRANT OPTION, but I get the same error message.

    try just
    GRANT ALL ON wordpress.* to wordpress ;
    and no other qualifiers. I think the key will be the wordpress.*, which will allow access to all wordpress database properties.

    Thread Starter philtronics

    (@philtronics)

    That did the trick!

    Now do I need to undo the other GRANT commands somehow, or can I leave it alone?

    Thank you,
    Phil

    Thread Starter philtronics

    (@philtronics)

    I got the Success page, saying WordPress was installed, and prompting me for a username and pw. But I can’t log on using the stuff I told it!

    I feel like I must be doing this the hard way.

    The rest of the GRANTs should be okay for now. I’d make sure the install runs first then tweak it.
    Make sure you point the webbrowser to 127.0.0.1/wordpress/wp-admin/install.php or whatever your particular site address is. That’s where it sets a temporary username for your wordpress admin account. The username will initially be ‘admin’ until you get in and start adding regular users. By the way, I would set up an separate user as an admin besides just the admin account.

    Thread Starter philtronics

    (@philtronics)

    Thanks again, I’m getting really close. The above url (with my domain name) brings up a page that says Directory Listing Denied
    This Virtual Directory does not allow contents to be listed. I bet if I set up the permissions some how it would work. That will be a quagmire I’m sure. The OS is Windows Server 2003 fwiw.

    Thread Starter philtronics

    (@philtronics)

    To clarify, that url up a login page. I log in, and that’s where the Directory Listing Denied page comes up.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Can't connect to MySql database’ is closed to new replies.