Dropping MySQL Archive Databases - mysql

I have MySQL 5.0 running on a Windows 2003 server. I was trying to drop an archive database when I received this error:
Error dropping database (can't rmdir './database_name/', errno: 17)
There are ARM and ARN files in every directory for every archive database on the server. From what I can tell, these are generated during an optimize.
Is it safe to remove these files manually so that a drop command in mysql will go through normally?

It could mean for example - database directory contains some files that is not belongs to mysql database. For instance .empty file.

Related

Migrating a Mariadb/wordpress site with only .frm files

My server crashed. My /home /www and lib/mysql were on a different hard disk so I have all the data. The original server was Debian 9 with Mariadb and an apache webserver. I planned to move to mysql so I have a debian 10 server with mysql. I also have another debian 9 server with Mariadb so that I can use sqldump to move my databases. All my databases moved over fine, except one that was a wordpress database. That directory only has .frm files in it, there are no .MYD or .MYI files. I tried copying them to /var/lib/mysql of the Deb9 server, changed the permissions and ownership. However, mysql dump gives the following error message
mysqldump: Got error: 1932: "Table 'dbname.tablename' doesn't exist in engine" when using LOCK enter code here
I tried copying them as is to the MYSQL server too, the server did not see the tables. In the MariaDB server command line interface it shows the tables. However when I try to view the contents of any table it says
Error 1932 (42S02): Table 'dbname.tablename' doesn't exist in engine
I get the same error when I try repair table.
Any ideas on how I can get this moved?
I have resolved my issue. Instead of copying only the database folder, I copied the entire /var/lib/mysql folder to the mariadb install. Then I did sqldump on each database and moved them to the mysql server. I'm not sure why the copy of the database folder didn't work but I got all my data back.

Cannot restore dump file to Compose for MySQL instance

I am currently working on migrating my client from AWS to IBM Cloud and I've created a Compose for MySQL instance. I created a dump file from the MySQL instance hosted on AWS and am trying to restore it on Compose for MySQL but I am receiving the following errors:
If I try to restore the structure only, I receive this error: "ERROR 1227 (42000) at line 313: Access denied; you need (at least one of) the SUPER privilege(s) for this operation". When I looked at line 313 in the dump file, it is attempting to create a stored procedure, so apparently my admin account does not have permissions to create stored procedures.
However:
If I try to restore a dump file with structure and data, I receive this error: "the table does not conform to the requirements of an external plugin". This error happens after the first table is created and the INSERT statement is attempting to restore the data to this table.
I am attempting to restore these dump files using MySQL Workbench connected to my Compose for MySQL instance. How can I restore one of these dump files (ideally the one with structure and data) to my Compose for MySQL instance?

MySQL corrupts after every server restart

I Have a bit of an odd problem. I am running MySQL and Drupal site from a windows environment (not by choice but it is just how things have worked out) and most of the time the site is fine however every time the server is restarted (from updates or for maintenance) The MySQL Database will corrupt.
When I log in to MySQL Work bench I notice that the server status is stopped and when I try to start it I get the error:
ERROR Fatal error: Can't open and lock privilege tables: Can't find file: 'user' (errno: 2 - No such file or directory)
and then MySQL Server fails to restart.
The only way around this problem is to delete data folder in the ProgramData/MySQL and then replace it with a backup from a fresh install of MySQL then import a backup of my tables and recreate my users.
My Question is what is causing MySQL to corrupt at every sever restart and what can I do to prevent this happening moving forward?
This occurs when mysql can not find or do not have permissions to user.MYD or user.MYI or user.frm in the data directory. When you start mysql, make sure that these files exist in data directory. You can just copy those files when mysql does not start
This worked for me:
Stick with the 32 bit.
Uninstall and make sure you then DELETE the mysql-data folder and all its subfolders before installing, and prefer to use the 32 bit (sometimes 64 bit versions are the problem).
(Source)

Restore MySql databases and error 1146

I have got a number of database on a local server. The server was cleaned up (disc cleanup) and mysql service was stopped. I tried to run the service again but it didn't work so I re-installed wampp. After installing it I could connect to mysql server and I see the databases and tables but it generates error 1146 once a table is clicked to open. Is there any way to restore the data from each database?
By the way, I have got a backup from mysql/bin folder which has been taken before installing wampp again.
Here is the error:
try to
Export the db
Delete them
Create them again with same names
Import the data into them
Is it possible to paste some of the exact error not only the code?

Mysql gives me:"Can't open and lock privilege tables: Table 'host' is read only"

I am facing problem restoring the mysql database. My primary database was mysql5.1 and now I am trying to copy it to mysql5.5. The database was backed by using Xtrabackup.
I am using Ubuntu 12.04.3 LTS on this server, mysql version is : 5.5.32-0ubuntu0.12.04.1-log
I have followed all the steps to restore using Xtrabackup, this created database files, which I have copied to a tmp directory.
I have modified my.cnf to point to this tmp directory. I have changed the tmp directory permissions and changed the ownership of the files to mysql user.
drwxr-xr-x 12 mysql mysql 4096 Sep 10 10:04 base
Now when I start the mysql server I get this error "[ERROR] Fatal error: Can't open and lock privilege tables: Table 'host' is read only"
I have given a try as follows:
Even tried installing mysql5.1 to see if that was the issue.
tried 'chcon mysql_db_t' to change the context but it gives me "can't apply partial context to unlabelled file"
I have used --skip-grant to get into database, but using this I can only access innodb tables only, MyIsam tables throw read-only error
After --skip-grant, I have used upgrade_mysql this throws me error that many tables are read-only.
I have removed apparmor too. and restarted too.
I have restored a different database(5.1 to 5.5) previously on Ubuntu 12.04.2 LTS without any issues.
Can some please point me in right direction, I am not sure whats wrong with permissions.
Thanks in advance.
Answering my own question,
The issue is with AppArmor. I am not sure why MySql is unable to access files even after uninstalling AppArmor.
Reinstalled AppArmor and moved the MySql profile under disabled profiles of AppArmor, even then it did not work.
I copied the database files under /var/lib/mysql/ and MySql stopped throwing errors