By jasonwright on
hi!
I just found that a site that I developed "crashed".. www.conorin.com and actually this has happened to another site that I also did.
Fatal error: Duplicate entry '0' for key 2 query: INSERT INTO drupal_sessions (sid, uid, hostname, timestamp) VALUES ('2f8aa489ae9a00b95a5e12d3a06833c5', 0, '84.230.204.26', 1150897653) in /home/conorin/public_html/site/includes/database.mysql.inc on line 66
Any ideas on how I can fix this and ensure that it doesnt happen again?
Thanks!
Jason
Comments
Jason: When I moved from 4.6
Jason: When I moved from 4.6 to 4.7 I had lots of the above type errors. I went to the table (if it is session table, you can empty the table) and made the primary key column auto increment. I think it is sid for session table. The tables I had problems, if I remember correct from my memory, are watchdog, accesslog, session, cache. I emptied all these tables and made the primary key column auto increment. WARNING. BACK up your database always and NEVER Empty Important tables.
start by recreating user 0
This type of error can happen if you delete certain required information from the database.
In your favorite mysql client, run the following (this is safe, queries will simply fail if data already exists):
INSERT INTO users (uid, name, mail) VALUES ('0', '', '');
INSERT INTO users_roles (uid, rid) VALUES (0, 1);
INSERT INTO node_access VALUES (0, 0, 'all', 1, 0, 0);
You can read more about the problem here.
--
Drupal tips, tricks and services
http://devbee.com/ - Effective Drupal
--
Devbee - http://devbee.net/
auto increment
its all about auto increment is not exported right in tables
reply
sorry, but I don't speak in english :P
in your database manager, insert this sql
INSERT INTO users (uid, name, mail) VALUES ('0', '', '');
it works for 4.6.9 and for 4.7.3
that's all
Hi i also encountered the
Hi i also encountered the problem for www.indrani.net
Fatal error: Duplicate entry '0' for key 2 query: INSERT INTO sessions (sid, uid, hostname, timestamp) VALUES ('c22ec53a37da41bed6a278daa23ec8e2', 0, '165.21.154.10', 1182313616) in D:\Clients\9097\indrani.net\indrani.net\includes\database.mysql.inc on line 66
i'm using drupal 4.6.7 what should i do? (i'm not a sql expert..)
i have inserted query as above
resulted in error message below, which means the table is actually fine. But i still cannot access my website http://www.indrani.net
Error
SQL-query :
INSERT INTO users( uid, name, mail )
VALUES (
'0', '', ''
)
MySQL said:
Duplicate entry '0' for key 1