This is quite odd, it's happening only for a some Databases, but I get this error:
ERROR 1010: Error dropping database (can't rmdir './main', errno: 66)
SQL Statement:
drop database `Main`
This happens over and over, even on Root user...
This happens even if there is nothing in the database.
mysql> drop database DB_NAME;
ERROR 1010 (HY000): Error dropping database
(can't rmdir './DB_NAME', errno: 66)
1) mysql -e "select ##datadir" -> /usr/local/mysql/bin/mysql
2) Go to DB folder: cd /usr/local/mysql/data/
3) Delete DB folder of DB with issue (in this case: "DB_NAME")
Source stack overflow
I figured out, and it wasn't all that hard, using the OS X terminal I entered this in:
open /usr/local/mysql/data/
then, I just deleted the folders. An admin password was required though.
Thanks to anyone that offered to help
Related
After a migration from mariadb to mysql-community, I have this error when I try to grant new users:
ERROR 1805 (HY000): Column count of mysql.user is wrong. Expected 43,
found 45. The table is probably corrupted
As I got the backup from as server I didn't own, I do'nt know the exact version of maria-db. But my mysql-server version is: community-server-5.6.38-2
I tried the solution posted on a lot of forums
mysql_upgrade --force -uroot -p
But this didn't give the expected results.
So I comparated the fields list from a brand new mysql community server and mine. And discovered that the 3 problematic fields where:
is_role
default_role
max_statement_time
So I did:
mysql -e "ALTER TABLE mysql.user DROP COLUMN is_role, DROP default_role, DROP max_statement_time" -uroot -p
And this worked
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
I connect my Rails app to MySQL database, working with that and after turning off the laptop and starting Rails and MySQL server again, I get the error
ActionView::Template::Error (Mysql2::Error: Table 'database.table' doesn't exist: SHOW FULL FIELDS FROM `table`):
This is in Rails log.
When I log in into MySQL through the terminal
mysql -u root -p
choose a database and then try to display data from a table, like
mysql> select * from users;
ERROR 1146 (42S02): Table 'database.users' doesn't exist
I google this issue and found a temporarily solution, but this is not appropriate because it involves remove all old data in the respective database:
cd /usr/local/mysql/data
sudo rm -rf database_name
So I would like to ask you for help - how to properly figure out this issue?
Thank you
Looks like you're using rails, did you issue the command
rake db:migrate
And while you're in mysql I suggest you to get the list of available tables with:
show tables;
Consider:
DROP DATABASE db_name;
ERROR 1010 (HY000): Error dropping database (can't rmdir './db_name', errno: 66)
The problem is that I don't know where the file/directory is located - this file is missing in /usr/local/mysql/bin/...
How do I fix this issue?
mysql> drop database DB_NAME;
ERROR 1010 (HY000): Error dropping database
(can't rmdir './DB_NAME', errno: 66)
Find the database directory:
mysql -e "select ##datadir" -> /usr/local/mysql/data/
Go to the DataBase folder: cd /usr/local/mysql/data/
Delete DB folder of the DB with the issue (in this case: sudo rm -rf DB_NAME)
If you are using XAMPP in OSX the data directory would be at
/Applications/XAMPP/xamppfiles/var/mysql
FYI for mac users with normal mysql server:
/usr/local/mysql/bin/mysql -u root -pPASSWORD -e "select ##datadir"
I am attempting to dump a database running on Amazon's RDS service, mysql version 5.5.27. Here's the command I'm running:
my-ec2-instance# mysqldump -hec2-xx-xx-xx-xx.compute-1.amazonaws.com -uuser -pwhatever mydb
I get the following error:
mysqldump: Couldn't execute 'show fields from `MyTable`': Can't create/write to file '/tmp/#sql_1405_0.MYI' (Errcode: 2) (1)
So, since the error message says its failing on "show fields", I tried to execute "Show fields from MyTable" from the mysql interpreter directly. I get what appears to be a file issue:
mysql> show fields from MyTable;
ERROR 1 (HY000): Can't create/write to file '/tmp/#sql_1405_0.MYI' (Errcode: 2)
however, on the same EC2 instance that I am getting this error on, I can create this file and delete it:
my-ec2-instance# touch /tmp/#sql_1405_0.MYI; ls /tmp/#sql*;rm /tmp/#sql_1405_0.MYI
/tmp/#sql_1405_0.MYI
rm: remove regular empty file `/tmp/#sql_1405_0.MYI'?
I've tried the same thing from my local machine, and I get the same result. Googling this has not borne fruit. How can I prevent this error from occurring?
As Mike Brant suggested, I resized the instance on EC2, which forced it to switch machines, re-sized it back to the former size, and the problem no longer occurred.
I'm still not clear on the root cause, but it does appear to be down to some kind of bad state or misconfiguration specific to the EC2 instance I was using at the time.