MySQL: Difference between revisions

Jump to navigation Jump to search
1,089 bytes added ,  25 October 2018
Line 179: Line 179:
* ''Last tested on Ubuntu 16.04.01 LTS (xenial)''
* ''Last tested on Ubuntu 16.04.01 LTS (xenial)''


<syntaxhighlight lang="bash">
<source lang="bash">
$ mysql -B -uusername -ppassword --disable-column-names --execute "show databases"
$ mysql -B -uusername -ppassword --disable-column-names --execute "show databases"
</syntaxhighlight>
</source>
 
== Restoring a table from .frm and .ibd files ==
 
Assuming you already have a running database, this demonstrates a restore of a table into a temporary database.
 
# Create a temporary database
#: Use a <code>create database</code> or other means to create a temporary database to use as to restore the table.
# Restore the structure of the table
#: Use '''mysqlfrm''' tool to extract ''create table'' script.
#: <code>mysqlfrm -server=root:password@localhost -port=3311 "path/to/mytable.frm" > "path/to/recovered_mytable.sql"</code>
# Recreate the table
#: Create the table using the generated script, or previously existing script that matches the backup structure.
# Replace .ibd file.
#: Remove the newly created .idb file by executing the following: <source lang="mysql">> ALTER TABLE mytablename IMPORT TABLESPACE;</source>
#: Copy the restored .ibd file into the folder that contains the .ibd file.
# Reactivate the table
#: Re-establish the link. <source lang="mysql">> ALTER TABLE mytablename IMPORT TABLESPACE;</source>
#: You can usually ignore the warnings (sometimes even errors) that show up.


== mysqldump returning Errcode 13 ==
== mysqldump returning Errcode 13 ==

Navigation menu