I'm running Drupal 6.5 and MySql 5.0.22 and I need to set all node UIDs to 1. The reason for this is I deleted a user that had certain nodes "attached" to him, so the nodes are no longer visible and I'm getting an "n/a" where the content should be. I've seen other posts that detail how to do this but when I run the query commands from those posts I get a syntax error 1064 (42000). I have an SSH connection to my database and I'm running the following command:
UPDATE node SET node.uid = 1 WHERE node.uid = 3;
I've tried running the command that way and this way:
UPDATE 'node' SET 'node'.'uid' = 1 WHERE 'node'.'uid' = 3;
Both have given me syntax errors. Is my syntax incorrect, or am I doing something else wrong? As you can probably tell I'm no db admin nor do I have any real Drupal experience. Please help if you can, thank you.
Comments
SSH connections get you to a
SSH connections get you to a machine and a shell prompt. What command are you using to access the database.
And if the site is hosted it likely has phpmyadmin in the cpanel.
I use the My command upon connecting via SSH
I use the My command upon connecting via SSH and then the DB name, which takes me to a prompt where I can run queries against the DB. Those instructions are according to my host. Would it be easier to accomplish this using phpmyadmin, assuming my host has it?
The first command looks fine
The first command looks fine so I am not sure what the cause of the error is.
What's the exact error you
What's the exact error you get? That query is structured fine.
Contact me to contract me for D7 -> D10/11 migrations.
This is the error I get
mysql> electrosonic *this is my database name*
-> UPDATE node SET uid = 1 WHERE uid = 3; *here is the command I'm issuing*
*here is the error I get*
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that correspon
ds to your MySQL server version for the right syntax to use near 'electrosonic
UPDATE node SET uid = 1 WHERE uid = 3' at line 1
You need to select your
You need to select your database first. You don't do that just by typing the database name. Start with
use electrosonicThen after you have selected it, run your command.
Contact me to contract me for D7 -> D10/11 migrations.
try using below command
try using below command :
UPDATE node SET uid = 1 WHERE uid = 3;
Abhishek Sawant
Drupal Developer
Running the command using PHPMyAdmin
I get a different error in this case. I get:
#1146 - Table 'electrosonic.node' doesn't exist
I don't have the ndbd module installed and running, does that make a difference?
Not sure what the ndbd module
Not sure what the ndbd module is. The error suggests you have drupal configured to use a different database than 'electrosonic'. You can look at settings.php (under sites/all/defaults) and check the settings for db_url to confirm. If this is a shared hosting account the db name is probably prefixed by the account name (ex myaccount_electrosonic)