Good evening
Update phpMyAdmin and when I export the database and import it into another server it sends me the following message:
duplicate entry '0' for key 'primary' mysql
I know what it means and what causes it.
But my question is this: In my previous version of phpMyAdmin I exported the databases and imported them without any problem. In my previous version the tables were exported in this format:
CREATE TABLE IF NOT EXISTS 'accion' (
'id_accion' int(10) unsigned NOT NULL AUTO_INCREMENT,
'nombre_accion' varchar(45) CHARACTER SET utf8 NOT NULL DEFAULT '',
'id_modulo' int(10) unsigned NOT NULL DEFAULT '0',
'url' text CHARACTER SET utf8 NOT NULL,
'mostrar' int(10) unsigned NOT NULL DEFAULT '0',
'accion_padre' int(10) unsigned NOT NULL DEFAULT '0',
'posicion' int(10) unsigned NOT NULL,
PRIMARY KEY ('id_accion'),
KEY 'id_modulo' ('id_modulo')
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1210 ;
In the new version of phpMyAdmin, you export it to me this way:
CREATE TABLE 'accion' (
'id_accion' int(10) UNSIGNED NOT NULL,
'nombre_accion' varchar(45) CHARACTER SET utf8 NOT NULL DEFAULT '',
'id_modulo' int(10) UNSIGNED NOT NULL DEFAULT '0',
'url' text CHARACTER SET utf8 NOT NULL,
'mostrar' int(10) UNSIGNED NOT NULL DEFAULT '0',
'accion_padre' int(10) UNSIGNED NOT NULL DEFAULT '0',
'posicion' int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
--
-- Indices de la tabla 'accion'
--
ALTER TABLE 'accion'
ADD PRIMARY KEY ('id_accion'),
ADD KEY 'id_modulo' ('id_modulo');
--
-- AUTO_INCREMENT de la tabla 'accion'
--
ALTER TABLE 'accion'
MODIFY 'id_accion' int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1210;
How can I configure phpMyAdmin to generate the export in the previous format?
If I export it in MySQL Administrator it works correctly, but I want to solve it with phpMyAdmin
If I manually correct the second export so that it looks like the first one, it works perfectly for me.
After @wchiquito's response , I add:
This is one of the tables:
CREATE TABLE 'historico_usuarios' (
'idregistro' int(10) UNSIGNED NOT NULL,
'estacion' varchar(45) NOT NULL DEFAULT '',
'fechayhora' datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
'usuario' varchar(20) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE 'historico_usuarios'
ADD PRIMARY KEY ('idregistro');
ALTER TABLE 'historico_usuarios'
MODIFY 'idregistro' int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1260;
And this is a the first insert
that I make when I enter the application to save a record of the user's income:
mysql_query("insert into historico_usuarios
(estacion,fechayhora,usuario)
values ('$pc','$fh','$login')");
The fields validated and are not null.