Ok, so I had a very large (40GB) database containing 1 table. I went to the Windows MySQL command prompt and typed:
drop database very_large_db;
I waited a few minutes and it came back with an error. I'm sorry but I forgot to record the error number. It then tried to reconnect and was unable to re-connect to the MySQL command prompt. I then rebooted the computer, went back to the command prompt, and tried to drop the database again. At this point, it just kicked me out and the MySQL service stopped (verified in services.msc). Next, I decided to go to the MySQL data directory in Windows Explorer and manually delete the database directory. It deleted no problem, and when I perform a "show databases;" command in the MySQL command prompt, it is no longer there.
Is there anything else I need to do to make sure the database was properly deleted? Is there any chance I corrupted any other databases in MySQL?
Thanks
Deleting the directory is equivalent to DROP TABLE. Try this: create a sub-directory in data and run 'SHOW DATABASES;' you'll see that MySQL just considers the directory to be a database.
Related
I tried everything, changing the port no. and all but it still did not start I had to end the mysql process using the activity monitor and now the tables wont respond. When I click the name it shows an error message: #1146 table 'table_name' doesn't exist!
My past projects will be wasted if they don't respond and I had forgotten to export the databases.
you can run this command to repair any database you have:
mysqlcheck -u mysql_username -p database_name
but if you see this error after running this:
Error: Table 'database_name.table_name' doesn't exist
you should drop your damaged table, all details can you find through this link
When trying (InnoDB):
DROP DATABASE mydatabase;
I almost inmediately get:
ERROR 2013 (HY000): Lost connection to MySQL server during query
I checked the timeouts and they are far enough from being short (600 seconds) so I stopped MySQL, removed mydatabase folder and started MySQL again. Then I re-created my DB and loaded it from a dump:
mysql -u <user> -p mydatabase < Dump.sql
But the process failed once and again due to some already existing table (though I'm sure it is not duplicated in the dump file), so at this point I don't really know what to do and whether I'm facing some InnoDB corruption issue (logs do not show anything related).
Any thoughts?
So finally, as (credits go for him) #t.niese's link points out, I quit trying to drop the (corrupted) DB and ended up recovering the dump into another DB, just changing its name. Fortunately I didn't need to have the same name, so I skipped the long process pointed out at that link. But alas it seems the corrupted database will stay in the ibdata1 file.
I'm pretty new to using MAMP as well as PHP and MySQL. When I first installed MAMP on my machine, everything was working fine (connections were made, etc.) and I was able to use the command line to work with MySQL without a problem.
Furthermore, when I first started using the command line, I could type the sql command "show databases;" and it listed the three databases that were found on my phpMyAdmin section of MAMP (information_schema, mysql, and performance_schema). I then added my own database to make it four databases and everything was still fine.
However, the last few times I have tried to use the command line and I type "show databases;", it only returns one database: information_schema, and I am unable to access any of the others. But on the phpMyAdmin page, it still shows that there are a total of four databases on my machine. Does anyone know why this is happening and/or how I can get the command line to display all of the databases again in order to make changes to the one I created?
Thanks in advance.
On the command line, use the -u option to indicate which user you want to connect to:
mysql -u root -p
Without that, it must be using an anonymous (blank) user with limited rights.
I want to copy the database tables from my production server to a local test machine so I can perform test om (copies of) the real data.
I stopped mysql and deleted all the frm, MYD and MYI files. Starting mysql here and querying show tables gives an empty result set. I then shut down mysql and copied all the frm, MYD and MYI files from the server. When starting mysql "show tables" shows the tables as expected but trying to query them I get the error message
ERROR 1017 (HY000): Can't find file: './WhateverTableIQuery.frm'
(errno: 13)
But the WhateverTableIQuery.frm file is on the disc and is identical to the one on the server.
Any ideas about what might be the problem?
I'd suggest giving two things a try:
1. Check Permissions
Make sure that your MySQL data directory and all the files in it are owned by mysql user and mysql group. This may not be the case if you copied the files onto your local test machine as root user:
chown -R mysql:mysql your-mysql-data-dir-here
2. Repair corrupted tables
Use mysqlcheck to check for corrupted tables and repair them if it finds any:
mysqlcheck -u root -p --auto-repair --all-databases
If you still can't use the tables after that then give mysqldump a go!
I encountered the same issue after restoring a MySQL database with frm and MYD files. After a number of hours spent I observed that I have configured the database directory with only read and write permission to mysql user but not execute permission. After adding execute permission to the database directory, the problem was solved.
I did have the very same issue a couple minutes ago and it took me a few minutes to realize that I had insufficient permission to access the .sql file I wanted to import.
In order to get rid of this problem you could just move the file to a place you know you have access to (with your current user) for sure. (eg. ~/Home_directory).
I hope I could help some lonely soul that was searching for the answer just like I was.
I had the same issue and did this...
Delete Migrations Folder
Drop the _migrationhistory table
Enable, Add and Update migration
I'm sure there's a much better way to solve this but, it worked for me.
I changed permissions for the mysql-data-directory as well as the <table>.frm file.
If using as root user:
chmod 600 mysql-data-directory chmod 600
mysql-data-directory/tableOfData.frm
If using as non-root user:
chmod 660 mysql-data-directory
chmod 660 mysql-data-directory/tableOfData.frm
This error, "General error: 1017 Can't find file", also happened on Windows with WAMP if the table doesn't exist.
Try following things:
repair whole database
change permission to mysql:mysql
restart mysql service
One of these will work.
I created a data base using mysql. I used MySQLDump to create one database backup file in text format (MySql 5.5 on Windows XP). The database is local on my machine (local host).
I am having trouble using the MySQL command to load the dump file to restore the database. I have done the following:
Research stack overflow for how to do it. I noticed there's a bug using the MySQL command to restore the data from a post. Before I run the command, I DROP the database and CREATE the database using MySQL workbench.
I type the following command in the DOS prompt to restore the database:
mysql -u root -p -h localhost -D matlab_data -o < backup.sql
backup.sql is a the backup file in text format created by MySqlDump.
I am then asked for the password which I enter. I get the DOS prompt right away with no error message. I've waited several hours for the command to run and the database is still empty.
I have tried various command formats over the last few days. If I enter incorrect data in the command line (non existen file, database, etc), I get an error message.
I feel I would not see the DOS prompt until the database is restored. If I don't DROP and CREATE the database, I get an error message. Otherwise, not.
Does anybody have any idea what the issue is? I realize that I could be making a stupid mistake.
Thank you for your help.
shell into the mysql console and run the sql file as this
If you are already running mysql, you can execute an SQL script file using the source command or . command:
mysql> source file_name
mysql> \. file_name
note that file_name must be an absolut path