Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

PhP & mysql question

  • 06-02-2004 9:13pm
    #1
    Registered Users, Registered Users 2 Posts: 1,368 ✭✭✭


    Ok guys, getting the following error:
    access denied for user 'root@excelsior'(Using password: No) Debug: error connecting to database

    heres the code

    <code>
    $dbHost = "excelsior";
    $dbUser = "root";
    $dbPass = "";
    $dbDatabase = 'PATIENTS_RECORDS';

    //connect to the database

    $db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("DEBUG:Error connecting to database.");

    mysql_select_db("PATIENT_RECORDS", $db) or die ("DEBUG:Couldn't select the database.");

    </code>

    any ideas??, if its a password problem, how do I set the password for mysql. I thought I left the password blank on initial set-up. The code used to work??

    Any help greatly appreciated :-)


Comments

  • Closed Accounts Posts: 37 Arion


    Okay you are trying to login as root, to the mysql server on excelsior.

    Are you the admin of said server? If so, the root passwd should have been blank when you set the MySQL server up. If you are not the admin, get the admin to setup you a username, and password, and use them in your script.

    To reset the root password, you will have to take down the mysql server, and put it back up with the 'skip grant tables' option, using the -Sg flag to the mysqld executable. Then use

    mysqladmin -u root password 'new_password'

    to change the password to new_password

    If you want to leave it blank, then putting nothing inside the quotes should(might) do the job.

    finally put the service back up normally.

    usually, you can start and stop services with /etc/init.d/mysql start|stop ( or something like that depending on your distro, if you are using Linux), but for the -Sg thing, you need to do it manally AFAIK.

    [edit}
    I've just re-read your code, and noticed that the MySQL server was on excelsior, and not localhost. Therefore most mysql commands will probably need to be executed either from excelsior, or with the -h flag. mysqld commands will need to be executed on excelsior anyway.
    [/edit}


  • Registered Users, Registered Users 2 Posts: 1,368 ✭✭✭king_of_inismac


    Hey Man,

    Ive tried what you suggested.

    The mysql stop command wouldn't work so I found the mysql process and killed it.

    I then ran safe_mysqld -Sg from my /usr/bin directory

    Next I entered the command : mysqladmin -u root password ' '

    I got the following response:Unable to change password; error;'you must have privilages to update tables in the mysql database to be able to change passwords for other'

    any ideas??

    Thanks :-)


  • Closed Accounts Posts: 37 Arion


    Hmmm, that's strange.

    I haven't done it in a while, but when you start the server by telling it to skip the grant tables, it shouldn't ask for passwords.

    If you're sure you successfully killed the mysqld, and are sure that the mysqld you connected to was the one you started by passing -Sg, maybe you should pass the full parameter, --skip-grant-tables.

    Failing that check the manual. The process is described there. It's a long time since I've read it, but it always worked for me. Maybe I'm forgetting something that I shouldn't be.

    let us know how you get on.


Advertisement