WordPress.org

Ready to get started?Download WordPress

Forums

first time install - error establishing a database connection (4 posts)

  1. dmhull
    Member
    Posted 1 year ago #

    Hi
    I'm trying to install wordpress for the first time ubuntu just to play around with it.
    Apache, php and mysql all appear to be installed OK and working.
    Wordpress (installed via ubuntu package manager) gives "Error establishing a database connection".

    I can log on to mysql as root
    mysql --user=root --host=localhost --password=mypass wordpress
    That seems to work OK but I cant log on as user wordpress.
    I have tried creating the user in diffgerent ways.
    Firstly, thru phpmyadmin. I log in as root, select localhost and click 'add new user'. I stick in user wordpress and the password twice, DO NOT click the confusing generate button, choose ioption to create a database with same name and grant all privileges etc and click add user.
    I can't log in using the password I just created.
    I have tried creating user via the mysql prompt. I can create a user with no password and log in ok. But if I provide a password then I cant log in :)
    I have logge din as root, changed the password but to no avail.

    mysql client api is 5.5.24

    I'm sure I'm making some basic mistake but I really need an expert to help me get sorted. It really shouldnt be this hard!

    thanks
    Martin

  2. You are going to have lots of problems using the Ubuntu package manager version of WordPress. Trust me, been there done that. The Ubuntu package uses weird sym links and splits up the wp-config.php file.

    Run
    apt-get remove wordpress
    apt-get autoremove
    apt-get purge wordpress

    Follow these instructions for creating your database http://codex.wordpress.org/Installing_WordPress#Using_the_MySQL_Client

    Now just download WordPress and unzip it into your root web directory and edit wp-config-sample.php with your database credentials and save it as wp-config.php

    cd /var/www
    wget http://wordpress.org/latest.tar.gz
    tar -xvf latest.tar.gz
    cd wordpress
    cp * ..
    cd ..
    rm -rf wordpress
    nano wp-config-sample.php
    //Edit and save as wp-config.php
  3. dmhull
    Member
    Posted 1 year ago #

    Hi
    Thanks for your reply. I got it sorted on my own but due to further problems I think I'll restart as you suggest.
    My problem was with mysql.
    From the page http://codex.wordpress.org/Installing_WordPress#Detailed_Instructions
    I had problems with
    mysql> GRANT ALL PRIVILEGES ON databasename.* TO "wordpressusername"@"hostname"
    -> IDENTIFIED BY "password";
    This returned an error something like 'syntax error near IDENTIFIED BY'. I split the command into 2 parts to create the user and then to set the password using SET PASSWORD and that worked for me.

    My current problem is that my wordpress page doesnt display any images or follow the stylesheet when viewed from another PC on my home network. It works fine from the PC hosting wordpress.

    So I reckon I'll just start again and follow your recommendations.

  4. ClaytonJames
    Member
    Posted 1 year ago #

    My current problem is that my wordpress page doesnt display any images or follow the stylesheet when viewed from another PC on my home network. It works fine from the PC hosting wordpress.

    As long as you use "localhost" in the WordPress URL, that's how it's going to work. You can make it accessible from your home network by assigning the Ubuntu server a static internal ip address and then installing WordPress from another machine on your LAN using that address as the installation URL. Example: http://192.168.x.x/wp-admin/install.php instead of http://localhost

    If you need to work from a browser on the server itself, you can add an entry to the hosts file on the server (if required) that resolves "localhost" to whatever internal ip address you've assigned the server.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.