Problems recovering a .frm file using mysqlfrm

Hope someone can help me, I researched many recovery answers in stackoverflow.

I made a mistake when copying a data folder from mysql and pasting it into a new mysql / mysl5.6.17 / data wamp 2.5 folder.

When I click on a table, it gives "the table does not exist." The following shows what shows

3688 [Warning] InnoDB: Cannot open craigmedia / wp_eg_grids table from InnoDB internal data dictionary, although there is a .frm file for the table. See http://dev.mysql.com/doc/refman/5.6/en/innodb troubleshooting.html for a solution to this problem.

I have a database folder containing .frm files.

I am trying to use mysqlfrm to restore a table, as explained by this link: https://dba.stackexchange.com/questions/71596/restoring-mysql-tables-from-ibd-frm-and-mysqllogbin-files

However, when I put the information in mysqlfrm, the results are displayed below:

1.mysqlfrm --server=root@localhost --port=445 --user=root C:/wamp/bin/mysql/mysql5.6.17/data/craigmedia/wp_eg_grids.frm > wp_eg-grids.txt Source on localhost: ...connected ERROR: Cannot read wp_eg_grids.txt. You must have read privileges to the file or path and it must exist. Skipping this argument. ERROR: Cannot read .frm file from >.frm. 

Running the utility: mysqlfrm --server = root @localhost --port = 445 --user = root C: /wamp/bin/mysql/mysql5.6.17/data/craigmedia/wp_eg_grids.frm> wp_eg-grid.text 'with code return '1', but the error message was not passed to the standard error, view the output from its execution.

Then I tried this.

 2. mysqlfrm --server=root@localhost :3306 c:/wamp/bin/mysql/mysql5.6.17/data/craigmedia/wp_eg_grids.frm --port=3307 --user=root 

A WARNING. Using a password in the command line interface can be unsafe.

 Source on localhost: ...connected. Spawning server with --user=root. Starting the spawned server on port 3307 ... The console has detected that the utility 'mysqlfrm' ended with an error code. You can get more information about the error by running the console command 'show last error'. Execution of utility: 'mysqlfrm --server=root@localhost :3306 c:/wamp/bin/mysql/mysql5.6.17/data/craigmedia/wp_eg_grids.frm --port=3307 --user=root' ended with return code '1' and with the following error message: Traceback <most recent call last>: File "G:\ade\build\sb_0-16088143-1438774726.78\Python-2.7.6-windows-x86-64bit\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module> File "scripts\mysqlfrm.py", line 422, in <module> File ".\mysql\utilities\command\read_frm.py", line 439, in read_frm_files File ".\mysql\utilities\command\read_frm.py", line 166, in _spawn_server File ".\mysql\utilities\command\serverclone.py", line 180, in clone_server File ".\mysql\utilities\command\tools.py", line 254, in get_mysqld_version I0Error: [Errno 13] Permission denied: 'version_check' 

I'm currently trying to access one .frm for testing, which is wp_eg_grids.frm and turns it into a wp_eg_grids.txt file. Someone may notice what I am doing wrong or know how to solve it.

+6
source share
2 answers

Try using the following syntax for mysqlfrm, which worked for me in a similar situation.

 mysqlfrm --server=root: password@localhost :3306 c:/wamp/bin/mysql/mysql5.6.17/data/craigmedia/wp_eg_grids.frm > c:/wamp/bin/mysql/mysql5.6.17/data/craigmedia/wp_eg_grids.txt --diagnostic --port=3307 -vvv --user=root 

Enable diagnostic mode to read .frm files byte-by-bit and generate a CREATE statement with maximum effort.

+3
source

Your problem may be similar to mine: MySQL spawned server does not start.

The problem is MySQL, starting with a temporary datadir , which is the current directory by default. In this directory you will have a new temporary directory (something like 62a77962-9a4b-49d0-b91a-a5e9eb71b894 ) with the correct permissions.

  • Linux: if you use root (the user runs mysqlfrm , and not the user you are running MySQL from), you are most likely in a directory /root/ that the mysql system user cannot read (even if the user is mysql root ).
  • Windows: the same problem, I think if you start as an administrator, the MySQL user may not have permission to read the current directory.

The solution is to move (using cd ) in a readable MySQL directory , for example /tmp/ on Linux (with all the security problems associated with this world readable directory), or possibly C:\ on Windows.

I found it by looking at the MySQL log (Linux: /var/log/mysql/mysql.log ) which said:

/usr/sbin/mysqld: Can't change dir to '/root/aa9fe487-0c77-4bb4-a829-036fc9919558/' (Errcode: 13 - Permission denied)

Launch command:

/usr/sbin/mysqld --no-defaults --basedir=/usr --datadir=/root/aa9fe487-0c77-4bb4-a829-036fc9919558 --pid-file=/root/aa9fe487-0c77-4bb4-a829-036fc9919558/clone.pid --port=3310 --server-id=101 --socket=/root/aa9fe487-0c77-4bb4-a829-036fc9919558/mysql.sock --tmpdir=/root/aa9fe487-0c77-4bb4-a829-036fc9919558 --user=mysql

Moving to /tmp/ fixes the problem, and mysqlfrm works as expected.

I would use the tmpdir parameter if available, but it is not as indicated in read_frm.py :

 # Since Python libraries correctly restrict temporary folders to # the user who runs the script and /tmp is protected on some # platforms, we must create the folder in the current folder temp_datadir = os.path.join(os.getcwd(), str(uuid.uuid4())) os.mkdir(temp_datadir) 

And MySQL doesn't have a real home ... or you may not want to bother with the /var/lib/mysql/ directory!

0
source

All Articles