Hi

This is a truely newbie question. I followed the instructions and installed the drupal and went ahead modifying the themes, everything seems to be working OK but when I want to post, it gives me this message:

-----message -------------------------
user error: Access denied for user: 'maryamr_dbuser@localhost' to database 'maryamr_dru'
query: LOCK TABLES sequences WRITE in /home/maryam-r/public_html/dru/includes/database.mysql.inc on line 97.
-----message -------------------------

I have a shared hosting account with an ISP. I have created a data base('maryamr_dru') and a user('maryamr_dbuser'). The problem is that I am so new in this that I do not even know what question to ask from who! Is this drupal, php, mysql, my ISPs permissions, PHP Admin, or ...

Can someone help me get on track to trouble shoot this problem and tell me where to start :?

Thanx
Jalal

Comments

killes@www.drop.org’s picture

If you had searched the site you'd easily have found the answer.

You are using mysql 4 and this needs the "lock table" permission to be explicetly granted to the db user.

Jalal’s picture

Thanks Killes,

Thank you for the hint I searched the site and I found it. My problem was the search keyword which you gave me!
My site is working just fine and I post the solution here for other people in case they do not find the original post:
------Solution--------
If you can't get the access from your host...
I wouldn't advise this unless you are running a sole-proprietor site without a lot of commentors.
You can go to the section in database.mysql.inc that says:

db_query("LOCK TABLES sequences WRITE");
$id = db_result(db_query("SELECT id FROM sequences WHERE name = '%s'", $name)) + 1;
db_query("REPLACE INTO sequences VALUES ('%s', '%d')", $name, $id);
db_query("UNLOCK TABLES");

Remove the top and bottom lines, so it just says:

$id = db_result(db_query("SELECT id FROM sequences WHERE name = '%s'", $name)) + 1;
db_query("REPLACE INTO sequences VALUES ('%s', '%d')", $name, $id);

Runs fine.

Again, I would not advise it if you have lots of users at once; from what I could find on the LOCK/UNLOCK query, not using it could slow things down or cause problems on a big and busy

killes@www.drop.org’s picture

The proper solution is to grant the db user the needed priviledges.

Jalal’s picture

I am using shared hosting and my ISP did not answer on running the command to grant the privillage on mySQL server, is there any ways around that?

killes@www.drop.org’s picture

clairem’s picture

I have just encountered this problem while installing Drupal on my ISP's server. I'm waiting for them to get back to me on how I can get the necessary permissions, but ...

I do have to wonder why Drupal uses this feature, when it's so troublesome to set up (unless you are running a whole server rather than a mere virtual host).

Mambo, for example, doesn't require this degree of access, and nor does the Wordpress Blog which I set up. I like Drupal, but I wonder why it makes things so difficult?

joel_guesclin’s picture

You can use phpMyAdmin (which in my opinion is a must if you're running a PHP/MySQL based site), to give the necessary privileges (Lock Table) to your user. If your ISP is properly set up for this, then you should easily be able to get to phpMyAdmin via Cpanel.

I have no commercial interest in this whatever - but I would thoroughly recommend doing your hosting with opernsourcehost.com - they specialise in PHP/MySQL/Apache Open Source CMS systems, will help you to set everything up, and are very helpful and responsive generally.

hong-1’s picture

I am encountering the same problem. I was still getting the same problem after commenting out the two lines. Looking deeper into the database.mysql.inc file yielded two functions: one to lock and the other to unlock.

Original

function db_lock_table($table) {
db_query('LOCK TABLES {'. db_escape_table($table) .'} WRITE');
}

function db_unlock_tables() {
db_query('UNLOCK TABLES');
}

Amended

function db_lock_table($table) {
/**
 * db_query('LOCK TABLES {'. db_escape_table($table) .'} WRITE');
 */
}

function db_unlock_tables() {
/**
 * db_query('UNLOCK TABLES');
 */
}
Cryssli@www.cryss.net’s picture

Recently this error appears to my blog. I described it to my provider (http://domain.freenet.de) and short after, this problem was fixed!

Chris

IM or email to:
Jabberwocky@amessage.de