MySQL said: Table doesn't exist in Sequel Pro - mysql

I have created a GameCenter type database in sequel pro using root, but for some reason every now and again I get the following errors when connecting to the database and trying to access the tables:
An error occurred while retrieving the information for
table 'Achievement'. Please try again.
MySQL said: Table 'gamecenter2.achievement'
doesn't exist
I have looked around and most people say it is a problem that occurs when copying a database from one place to another however I am not doing that.
In terminal using MySQL the database and tables all show up but I get the same error when trying to access a table's contents:
SHOW COLUMNS FROM Achievement;
ERROR 1146 (42S02): Table 'gamecenter2.achievement' doesn't exist
Any help with this would be really appreciated as running the CREATE TABLES and INSERT over and over is getting quite tiresome!

I've had the same problem recently (and same error message in sequel pro) and have since discovered that it is because certain types of MySQL databases (i.e. those using InnoDB) store the actual data for individual tables outside in a file named "ibdata1" (you can read more on this here: https://dba.stackexchange.com/questions/15531/why-does-innodb-store-all-databases-in-one-file). Thus, if you restore individual folders for your database(s) using time machine, you are actually just restoring empty database architectures without the good stuff inside. If you haven't also restored that "ibdata1" file along with the appropriate "ib_logfile" files it won't be able to find the data. The solution is to make sure you've also restored those files (or a recent good copy).
Do also make sure you stop the mysql service before restoring anything, i.e. "mysql.server stop" from the command line (or "launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist" if you've installed mysql using homebrew).

Related

Error phpmyadmin pma__tracking and others does not exist

I recently downloaded XAMPP on my Mac, running Yosemite. Once installed, I tried to use phpmyadmin. I was able to create a database and in the SQL tab create a Table for the database using the "CREATE TABLE ..." query, but I cannot view that database or any of the databases that came loaded with the program. Anytime I click on the database name on the left hand side, I get an error saying that
"#1932 - Table pma__tracking does not exist in engine"
This error also occurs when I try to run "select * ..." queries from the SQL tab.
I have tried altering the config.inc.php file as suggested in other posts, and this did not work. I tried importing the create_tables.sql from the example folder and it gives the same error.
I am able to write .php scripts to query the database created and to add/retrieve data from it, but I cannot do any of this through the phpmyadmin tool, which would be very helpful, and I think might cause more problems later in my development.
Any thoughts on how to configure/set up phpmyadmin to work as its supposed to?
Thanks in advance.
You have to do both: use the .sql script to create these configuration storage tables, and specify their name in config.inc.php. Afterwards, log out and log in to see the effect.

Mysql is not working correctly

Hello Stackoverflow,
I was trying to connect to my MySQL database through Coda 2. I connected, created a database called 'database1' (for example), then I tried to create a table called 'user', but I get this error:
MySQL said: Table 'user' is read only
I was surprised because it had worked previously with other databases long time ago. I went to my xampp files, //xampp/mysql/data/database1/ and then I found out that user.ibd is there alone. So I first tried to change the properties of the files by disabling read-only. The problem is that when I did that, close the properties windows, and opened again I would get the read-only check box on. So I gave up on that. So I said ok, I will just create the database from my server instead. So I when to phpmyadmin, I see that database1 is created but there is no table called 'user'. So I try to create a table and I get this error:
#1813 - Tablespace for table '`database1`.`user`' exists. Please DISCARD the tablespace before IMPORT.
I then I found out I cannot even do much with phpmyadmin from my server. I tried reinstalling xampp, but it was impossible for me to remove the origianal because it was "already" in use. Please help me and thank you!
EDIT: I can apparently create databases but not tables. Just to clear that up.
You can try using CLI and logged into mysql and create a new database and a table. If it's working, there's something wrong with your phpmyadmin not mysql. Make sure you logged in as the same user (whom have root privileges) when creating the database and table.

Migrated Joomla Site shows Table doesn't exist

I have a joomla 2.5 site created locally on my machine, that I've migrated to a vps running nginx, php and mysql. Here is what i did in order:
1. Uploaded all the joomla files in the public_html
2. Changed all the files permission to 644 and all the folders to 755
3. Imported the database.sql to mysql using these commands:
--> mysql> create database databasename;
--> mysql> GRANT ALL PRIVILEGES ON
databasename.* TO username#localhost IDENTIFIED BY 'password';
--> mysql> flush privileges;
--> mysql> exit
--> user#vps:~$ mysql -p -u username database_name < file.sql
I can see all my tables inside the database already, and changed all the needed information on my joomla configuration.php but when i open my site, i get this error:
Table 'databasename.s1t3j0s_session' doesn't exist SQL=INSERT INTO `s1t3j0s_session` (`session_id`, `client_id`, `time`) VALUES ('rh249ehb2tbsqkdff34v177d76', 0, '1357339991')
Where did i got it wrong?
I have migrated wordpress site to the same server with no error.
I've been having trouble with it for weeks. What I needed was a backup copy on my system. However, when I uploaded the database from the remote server onyto my localhost I was getting error messages relating to the session table not existing (the same error that you are getting).
I tried all of the tips relating to deleting and re-creating the tables, but this did not work.
The only solution which worked 100% - which I finally discovered today, was to re-install Joomla 2.5 (I used a fresh install), and then do the following:
Instead of uploading the database from site containing the correct content, instead go through the SQL file itself (i.e. the one you will have exported for upload before encountering problems), and manually process each one of the insert statements into your SQL console directly (I'm using PHPMyadmin). In other words, don't attempt to import the whole file as you normally would. To do this will just result in errors.
For some reason, Joomla 2.5 has an issue with tables that are already populated with data being replaced by a dump file or replacement, sometimes duplicate, data. Hence the need for a fresh install....
Before processing each of the install statements individually (this can take a while - it took me about an hour and a half), go through each of the Joomla tables and make sure that NONE of them are populated with any data whatsoever (therefore when you process the install statements they will not be replacing existing data - because you will have removed all data from populated tables).
So long as you make sure that no INSERTED data has been added to the tables prior to the migration, this will solve your problem.
So to summise:
1/ Get a fresh J2.5 install.
2/ Delete all popolated table data from every joomla table.
3/ Copy and paste each of the insert statements from the exported mysql file containing the correct data. Process each statement individually (this is optional, but highly recommended: to do it this way enables you to counter and pinpoint any individual errors if and when they occur - without having to look through the entire mysql file)
...Go to your site: bingo - it should work!
Make sure the value of $dbprefix in configuration.php under the Joomla directory has the correct value by checking it against the actual db prefix used (open phpMyAdmin and choose the Joomla database to check for this).
Just truncate the data in the session table and do the process again. You have nothing to worry about truncating because there are no valuable data. Session table sometimes messes up stuff.
On Unix, table names are case sensitive. On Windows, they are not. Fun, isn't it? Kinda like their respective file systems. Do you think it's a coincidence?
Caveat: it probably depends on table type; MyISAM.
Field names are case-insensitive regardless.
I had this problem,
in my case, I imported the database through the cpanel and later on got this error message. I later found out that importing database through the cpanel didnot import the tables, just the database name. So I went to the phpmyadmin and import the database there once again, and solved.

Restore MySQL from files (without dump)

Is it possible to duplicate a MySQL database from their files? [I know mysqldump would be the best method to duplicate a db, but that's not possible as all we have is the backed up files from the mysql folder].
We have the ibdata1 file, the ib_log* files, and the full directories for the three db's we want to restore from the backed up files (folders seem to contain all needed frm and par files). Obviously already tried just to copy all the files into /var/lib/mysql and though it appeared the structure was intact attempts to access the data were unsuccessful.
i.e. show databases will show the db's, use dbname works, and show tables properly displays the tables, but when trying to access the data from [any] table (via query) it says ERROR 1146 (42S02): Table 'dbname.dbtable' doesn't exist - despite mysql having happily showed us the table does exist when we did show tables.
Should also point out the service was stopped prior to copying files and all files chown'ed to have mysql as owner and then the service restarted prior to attempting to access the data.
To answer your question indirectly, there is some information here regarding setting up replication using a raw file copy. So I guess the answer is possibly yes, but it may depend.
http://dev.mysql.com/doc/refman/5.0/en/replication-howto-rawdata.html
Not wishing to add to your current pain, but were you relying on a backup that you have never tried / don't know how to restore?

Bug? #1146 - Table 'xxx.xxxxx' doesn't exist

I am using windows XP. I am creating a table in phpMyAdmin using its built-in create table feature,
my database name is ddd.
It generates the following code:
CREATE TABLE `ddd`.`mwrevision` (
`asd` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`sddd` INT NOT NULL
) ENGINE = INNODB;
and the following error shows up:
MySQL said:
#1146 - Table 'ddd.mwrevision' doesn't exist
What might be the problem?
I also had same problem in past. All had happend after moving database files to new location and after updating mysql server. All tables with InnoDB engine disappeared from my database. I was trying to recreate them, but mysql told me 1146: Table 'xxx' doesn't exist all the time until I had recreated my database and restarted mysql service.
I think there's a need to read about InnoDB table binaries.
I had the same problem and can't get a good tip for this over the web, so I shared this for you and for all who needs.
In my situation I copy a database (all files: frm, myd) to the data folder in MySQL data folder (using Wamp at home). All thing was OK until I want to create a table and have the error #1146 Table '...' doesn't exist!.
I use Wamp 2.1 with MySQL version 5.5.16.
My solution:
Export the database to file;
verify if exported file is really OK!!;
drop the database where I have issues;
create a new database with the same name that the last;
import the file to the database.
FOR ME IS PROBLEM SOLVED. Now I can create tables again without errors.
Restarting MySQL works fine for me.
In my case I ran this command even if the table wasn't visible in PhpMyAdmin :
DROP TABLE mytable
then
CREATE TABLE....
Worked for me !
Check filenames.
You might need to create a new database in phpmyadmin that matches the database you're trying to import.
I had the same problem. I tried to create a table in mysql and got the same error. I restarted mysql server and ran the command and was able to create/migrate table after restating.
Today i was facing same problem. I was in very difficult situation but what id did i create a table with diffrent name e.g (modulemaster was not creating then i create modulemaster1) and after creating table i just do the rename table.
I encountered the same problem today. I was trying to create a table users, and was prompted that ERROR 1146 (42S02): Table users doesn't exist, which did not make any sense, because I was just trying to create the table!!
I then tried to drop the table by typing DROP TABLE users, knowing it would fail because it did not exist, and I got an error, saying Unknown table users. After getting this error, I tried to create the table again, and magically, it successfully created the table!
My intuition is that I probably created this table before and it was not completely cleared somehow. By explicitly saying DROP TABLE I managed to reset the internal state somehow? But that is just my guess.
In short, try DROP whatever table you are creating, and CREATE it again.
As pprakash mentions above, copying the table.frm files AND the ibdata1 file was what worked for me.
In short:
Shut your DB explorer client (e.g. Workbench).
Stop the MySQL service (Windows host).
Make a safe copy of virtually everything!
Save a copy of the table file(s) (eg mytable.frm) to the schema data folder (e.g. MySQL Server/data/{yourschema}).
Save a copy of the ibdata1 file to the data folder (i.e., MySQL Server/data).
Restart the MySQL service.
Check that the tables are now accessible, queryable, etc. in your DB explorer client.
After that, all was well. (Don't forget to backup if you have success!)
Column names must be unique in the table. You cannot have two columns named asd in the same table.
run from CMD & %path%=set to mysql/bin
mysql_upgrade -u user -ppassword
Recently I had same problem, but on Linux Server. Database was crashed, and I recovered it from backup, based on simply copying /var/lib/mysql/* (analog mysql DATA folder in wamp). After recovery I had to create new table and got mysql error #1146. I tried to restart mysql, and it said it could not start. I checked mysql logs, and found that mysql simply had no access rigths to its DB files. I checked owner info of /var/lib/mysql/*, and got 'myuser:myuser' (myuser is me). But it should be 'mysql:adm' (so is own developer machine), so I changed owner to 'mysql:adm'. And after this mysql started normally, and I could create tables, or do any other operations.
So after moving database files or restoring from backups check access rigths for mysql.
Hope this helps...
The reason I was facing this was because I had two "models.py" files which contained slightly different fields.
I resolved it by:
deleting one of the models.py files
correcting references to the deleted file
then running manage.py syncdb
I got this issue after copying mytable.idb table file from another location. To fix this problem I did the following:
ALTER TABLE mydatabase.mytable DISCARD TABLESPACE;
Copy mytable.idb
ALTER TABLE mydatabase.mytable IMPORT TABLESPACE;
Restart MySql
I had the same issue. It happened after windows start up error, it seems some files got corrupted due to this. I did import the DB again from the saved script and it works fine.
I had this problem because of a trigger not working..Worked after I deleted the trigger.
In my case, MySQL's parameter; lower_case_table_names was configured = 0.
It causes queries related with using upper cases will not work.
For me it was a table name upper/lower case issue. I had to make sure that table case name matched in a delete query, table notifications was not the same as Notifications. I fixed it by matching table name case with query and what MySQLWorkbench reported.
What is wierd is that this error showed up in a worked sql statement. Don't know what caused this case sensitivity. Perhaps an auto AWS RDS update.
if you are modifying mysql bin->data dir's and after that, your database import will not works
so you need to close wamp and after that start wamp
now database import will work fine
Make sure you do not have a trigger that is trying to do something with the table mentioned in the error. I was receiving Error Code: 1146. Table 'exampledb.sys_diagnotics' doesn't exist on insert queries to another table in my production database. I exported the table schemas of my production database then searched for instances of exampledb.sys_diagnotics the schema SQL and found a debugging insert statement I had added to a table trigger in my development environment but this debug statement had been copied to production. The exampledb.sys_diagnotics table was not present on my production database. The error was resolved by removing the debug statement in my table trigger.