One of my clients complained that his database disappeared without any reason. I guess he must have dropped the database by mistake. But I just want to make sure that this can not happen automatically. The ibdata and iblog files are there but the directory (for e.g. company) is missing.
It does not happen automatically. If you log the SQL queries (bin log, for example) you can search if there was a "drop database" query.
if you properly manage your database permissions then this should not be possible, only give drop DB access to root or to your superuser.
Related
I'm using Appserv for local MySQL hosting. I had to reset my computer. I forgot to make backup for MySQL database and used Win 10 reset feature. So it removed all the applications but not personal files. After resetting my pc, I set up the Appserv again. I got into phpMyAdmin. On the left side, I can see all of the tables. But when i click on them, I'm having an error message "#1146 - Table 'database.table' doesn't exist". So i only have the MySQL data files which has database's .frm and .ibd files.
My question is, can i recover tables with these .frm and .ibd files?
Note: ib_logfile and ibdata files are overwrited after setup.
A quick search on Google I found an article that may help you but bear that in mind that once you erase something permanently by mistake or otherwise and if you haven't made the appropriate backups then I am sorry to say that whatever you do to try and resurrect it won't work.
Nevertheless, try out the link below and let me know of your progress:
http://www.voxteneo.com/restoring-tables-mysql-database-frm-ibd-files-available/
I'm sure that there are a lot of people facing my problem; I had copied the data folder inside mysql on the hard disk, then format my computer, then I have pasted the data folder,
then all databases shows the number of tables, and when I make query show tables.
Its showing all tables inside database, but when I try to access the tables, it's showing table does not exist?
Please, I have a lot of projects, can any body help me?
Note that there was no password on the previous version and the user was root as now.
Please help.
I did not move any database file, but I had the same error message "No tables found in database" within PhpMyAdmin. But I could access the database by sql. I found out that it was caused by the browser. Using another browser or a private window helped. Did not try a restart or deleting cache so far.
If your phpMyAdmin no longer sees any tables in any of your local databases, that is because permissions change away from mysql.mysql on any database directory under /var/lib/mysql to, say, root.root (most probably).
You will have to change the owner from root.root to mysql.mysql, to do this, youâll need root access and putty. Key in this command:
chown -R mysql.mysql /var/lib/mysql/
Probably a duplicate: MySQL Table does not exist error, but it does exist
But moving files is not the way to save the database,best way is the export,import.
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?
I did a drop query on a MySQL table... my GUI interface crashed right in the middle of the process. The table does not exist in the listing; however, when I go to make a new one it says that there is already a table with that name. I tried doing a DROP TABLE and a RENAME on this phantom table but both queries run endlessly.
FYI I am unable to restart MySQL because shit might break on our live sites.
Any help is greatly appreciated.
Try repairing the table :
http://dev.mysql.com/doc/refman/5.1/en/repair-table.html
The tablename matches three files in the filesystem with a .frm, .myd and .myi extension (for the table definition, data and index files respectively) One of these files is corrupted, which prevents MySQL from carrying out your order.
Option 1 delete files from the filesystem
Have a look at the filesystem to see which file still exists.
If the .frm file is missing, you should be able to delete the other two files.
If the .frm file is still there do not delete, MySQL still has a lock on that file.
Option 2 repair the database
Use the myisamchk to diagnose and repair your database.
See: http://forge.mysql.com/wiki/MySQL_Internals_File_Formats
And: http://dev.mysql.com/doc/refman/5.0/en/myisam-repair.html
Check the directory where mysql stores the databases. On Ubuntu it's in /var/lib/mysql, but it may be different depending on your OS and configuration. Inside that directory there is a directory for every database, go into the directory for the problematic database, and delete any file that are the table name with extensions .frm, .myd, and .myi.
Sounds like you have a disconnect between what you have and what your server thinks you have.
You'll need SSH access and have to repair the table manually.
Log in to SSH and type:
mysql -u root -p
And enter your root mysql password.
Then
show databases
And it will list all the databases on your server.
Select the database you want with
use databasename;
Then
show tables;
This should list every table in your database. It's likely that it's still shows up there, so do a
drop tablename;
Hopefully that will correct your issue.
Ended up restoring from a backup... editing files in the file system is scary and may have required a restart.
I can not use MySQL. MySQL is on my local computer. Currently I added skip-grant-tables in My.ini so I can use MySQL. But I have no privilege to create a new database. My problem is tough, although I asked related questions on SO, but no answer can resolve my problem. I almost give up. So I lower my expectation. I am developing a website, so I need to create database, tables and operate tables. You don't have to consider security. Is there a simple solution that can give me privilege to create a new database? Maybe by adding some command in my.ini or something? You won't need to completely resolve my problem. Maybe after the development, I will upload the database and tables to another server(The current database server is my personal computer, windows XP) so I can uninstall and reinstall MySQL.
The root of problem is that I lack privileges.
I'm not sure if this will work for you, since you might need to have elevated privileges in the first place, but it's worth a shot.
There should be a database called mysql. Take a look in there, and you'll see a table called users. For each record, there's a heap of columns named Select_priv, Insert_priv, etc. For your user record, change each of these to "Y".
It sounds a bit like your installation went astray.
Maybe uninstall/resinstall is your best option, assuming that you've never been able to connect, so there is no data to consider.
Take your time on the installation, and have a look at MySQL Postinstallation Notes
you have 4 questions open about this specific problem. instead of opening duplicates, you should instead update just one of them with new information.
but the simple solution to your problem is to download the ZIP file of mysql for your mysql version from the mysql website and just copy the data\mysql folder in to your data file, then restart the service. this will give you a root user with a blank password that has full access.