Same problem occurred with me while creating a view.The view was present earlier then due to some changes it got removed But when I tried to add it again it was showing me "view already exists" error message.
I had this problem on Win7 in Sql Maestro for MySql 12.3. Enormously irritating, a show stopper in fact. Nothing helped, not even dropping and recreating the database. I have this same setup on XP and it works there, so after reading your answers about permissions I realized that it must be Win7 permissions related. So I ran MySql as administrator and even though Sql Maestro was run normally, the error disappeared. So it must have been a permissions issue between Win7 and MySql.
I've been fighting with this all day: I have a Perl script that builds a set of tables by first doing a DROP IF EXISTS ... on them and then CREATEing them. The DROP succeeded, but on CREATE I got this error message: table already exists
I finally got to the bottom of it: The new version of MySQL that I'm using has a default engine of InnoDB ("show engine \G;") I changed it in the my.cnf file to default to MyISAM, re-started MySQL, and now I no longer get the "table already exists" error.
So if this is an option, move all working tables to another DATABASE, drop the old one (you might have to manually remove any files from the database folder before the drop to work), rename the new one, and you 'should' be back on your way. Apparently, whatever gets 'cached' using InnoDB is dropped along with the original database.
I had the same problem at Mac OS X and MySQL 5.1.40. I used eclipse to edit my SQL script and than I tried MySQLWorkbench 5.2.28. Probably it converted newline characters to Mac format. I had no idea about what's wrong with my script until I commented out the first line in file. After this this script was interpreted by mysql as a one single comment. I used build-in TextEdit Mac application to fix this. After line-breaks was converted to the correct format, the error 1050 gone.
For me the problem was caused when using a filesystem copy of the mysql database directory instead of mysqldump. I have some very large tables, mostly MyISAM and a few InnoDB cache tables and it is not practical to mysqldump the data. Since we are still running MyISAM, XtraBackup is not an option.
The same symptoms as above happened to me. The table is not there, there are no files in the directory that pertain to the table, yet it cannot be created because MySQL thinks its there. Drop table says it's not there, create table says it is.
The problem occurred on two machines, both were fixed by copying backups. However, I noticed that in my backup that there was a .MYD and .MYI file, even though I was under the impression that these files are not used for InnoDB. The .MYD and .MYI files had an owner of root, while the .frm was owned by mysql.
gosh, i had the same problem with osCommerce install script until i figured out the mysql system has many databases and the create table query copies itself into each one and thus droping only the working table on active db didnt help, i had to drop the table from all dbs
I stumble upon the fact that (one of many in) the CREATE statement did get through when I rectified the database name case sensitivity. This clicked something. I repeated the same for the other tables.
SOLUTION: The dump i was using might have been from a different version of MySql. I got permission to connect to the staging MYsql using the local(installed on my machine) mysql workbench. I did not rdp into the staging server to login to staging mysql workbench. Created a dump from there. Ran the dump and it worked like a sweet.
I've just had the same error but I knew the table already existed and wanted to add to it. I'm adding my answer as this question comes up as no.1 for me on google when looking for the same error but for a slightly different scenario. Basically I needed to tick
I had the same error importing a .sql dump for a Magento eCommerce on a new empty database. I've tried some of the solutions above but none worked, I've fixed the problem changing the way the dump was created.
Cuando se crea una instancia nueva de base de datos, el usuario maestro predeterminado que se utiliza obtiene ciertos privilegios para esa instancia. No se puede cambiar el nombre de usuario maestro despus de crear la instancia de base de datos.
Le recomendamos encarecidamente que no utilice el usuario maestro directamente en sus aplicaciones. En lugar de ello, es mejor ceirse a la prctica recomendada de utilizar un usuario de base de datos creado con los privilegios mnimos necesarios para su aplicacin.
Si elimina los permisos para el usuario maestro de forma accidental, puede restaurarlos modificando el clster de la instancia y estableciendo una nueva contrasea para el usuario maestro. Para obtener ms informacin acerca de la modificacin de un clster de instancia, consulte Modificacin de una instancia de base de datos de Amazon RDS.
ADMINISTER DATABASE TRIGGER, ALTER DATABASE LINK, ALTER PUBLIC DATABASE LINK, AUDIT SYSTEM, CHANGE NOTIFICATION, DROP ANY DIRECTORY, EXEMPT ACCESS POLICY, EXEMPT IDENTITY POLICY, EXEMPT REDACTION POLICY, FLASHBACK ANY TABLE, GRANT ANY OBJECT PRIVILEGE, RESTRICTED SESSION, SELECT ANY TABLE, UNLIMITED TABLESPACE
ADMINISTER BULK OPERATIONS, ALTER ANY CONNECTION, ALTER ANY CREDENTIAL, ALTER ANY EVENT SESSION, ALTER ANY LINKED SERVER, ALTER ANY LOGIN, ALTER ANY SERVER AUDIT, ALTER ANY SERVER ROLE, ALTER SERVER STATE, ALTER TRACE, CONNECT SQL, CREATE ANY DATABASE, VIEW ANY DATABASE, VIEW ANY DEFINITION, VIEW SERVER STATE, ALTER ON ROLE SQLAgentOperatorRole
La replicacin MySQL resulta muy til en trminos de seguridad de los datos, solucin Fail-Over, balanceo de carga, backups y para la realizacin de anlisis sin perjudicar el rendimiento. En este post vamos a aprender cmo replicar nuestro servidor MySQL de manera que nuestras bases de datos sean idnticas en dos servidores distintos, y que nicamente necesitemos escribir en uno de ellos para que los datos sean transferidos automticamente al otro servidor.
Cuando escuchamos la expresin replicar una base de datos, normalmente lo primero que nos viene a la cabeza es la posibilidad de tener varias copias de la misma informacin, a modo de backup, para poder recuperarla en caso de que se produzca un fallo en el servidor. Pero la replicacin de una base de datos ofrece otras ventajas tambin, por ejemplo, nos permite realizar backups de las bases de datos directamente sobre el esclavo, sin que la escritura en el maestro afecte a nuestra copia de seguridad; nos permite disponer de la informacin duplicada, de forma que puedan balancearse las consultas entre los dos servidores en caso de ser muy pesadas; tambin permite realizar los anlisis necesarios sobre el esclavo, que normalmente consumen muchos recursos, sin perjudicar el rendimiento en el maestro.
Ahora nos conectamos al servidor MySQL como root, pues vamos a crear un usuario para el servidor esclavo y a otorgarle permisos para la replicacin de los datos (reemplaza esclavo y contrasea por el usuario y contrasea que desees):
Toma nota del nombre del archivo mostrado anteriormente (mysql-bin.000002) y de la posicin (1112) ya que la necesitaremos despus para la configuracin del esclavo. Ahora exportamos todas las bases de datos as como la configuracin del maestro:
Como ves, la configuracin es muy parecida a la que hemos realizado en el servidor Maestro, slo que en este caso le indicamos a nuestro esclavo cul es la IP del servidor Maestro, cuntos segundos tardar en volver a intentar la conexin en caso de que falle el primer intento, y el usuario y contrasea que creamos en el servidor Maestro para permitir la replicacin.
Ahora accedemos a MySQL como root, detenemos el esclavo, y le indicamos el nombre del archivo del Maestro (mysql-bin.000002) y la posicin (1112) que obtuvimos durante la configuracin del Maestro, con el comando SHOW MASTER STATUS;. Recuerda que en el siguiente comando debes reemplazar la IP por la IP de tu Maestro, as como el usuario y contrasea que creaste para conectarte a l:
Si obtienes algo como esto, significa que tienes tu replicacin Maestro/Esclavo funcionando y perfectamente sincronizada. Si deseas probarlo, slo tienes que crear un registro nuevo en cualquier base de datos del servidor Maestro, o incluso una base de datos completa y vers que es inmediatamente replicada en el esclavo. En este reporte que obtenemos del estado del Esclavo, los campos ms importantes son Last_SQL_Error, que estar correcto mientras se encuentre en 0; en caso contrario habr que mirar qu ha sucedido y reiniciar el servicio Esclavo con los comandos stop eslave y start eslave; y el campo Seconds_Behind_Master, que indica cuntos segundos est retrasado el Esclavo respecto a su Maestro. Este valor nunca debe ser demasiado alto.
En ocasiones, puede efectuarse una consulta errnea que resulte en un error de replicacin. Aqu vamos a ver cmo poder resolverlo y continuar replicando los datos sin tener que configurar de nuevo todos los pasos anteriores.
Lo primero es detectar el error, de modo que lo buscaremos en primer lugar en el log de MySQL (dependiendo del Sistema Operativo que utilices, tendrs el log de MySQL en una ubicacin u otra), en CentOS solemos encontrarlo en el directorio /var/lib/mysql/error.log.
Con esto le indicamos al esclavo que ignore la ltima consulta realizada (que es la que nos caus el error). Si quieres ignorar dos consultas, slo tendrs que cambiar el valor de ese parmetro de 1 a 2, y as con cuantas consultas desees ignorar.
Ya hemos aprendido cmo realizar una replicacin de un servidor MySQL Maestro/Esclavo y a solucionar los posibles problemas que puedan surgir con la replicacin MySQL. Ahora no tenemos excusa para tener siempre a buen recaudo nuestras bases de datos.
En ProxAdmin le ofrecemos servicios de administracin de servidores, soporte helpdesk externalizado y servicios IT especializados que le permitirn mantener una presencia en internet consistente y segura.
795a8134c1