Export DATA from PhpMyAdmin NO structure

0

again with a query. This time my question is How to export the DATA from PhpMyAdmin I do not need to back up its structure, ie the tables and columns only, also the data, of course, if this is possible . If it is not, it may be possible to see the complete query with which the table or bd was created along with its respective insertion of data. My case is that I have a BD already done but I need to move it completely to another side, it is really extensive, and I do not want to have to insert the data again. Thanks in advance.

    
asked by Jalkhov 27.02.2018 в 16:20
source

2 answers

1

When you are going to do delicate operations on the database, either because of the nature of these operations, or because they require more time, it is better that you do it from the console or command line.

The time difference is considerable and you will have less risk of the operation failing or being blocked halfway.

Duplicating a database using the console is relatively easy.

  • You create the new database

    CREATE DATABASE nuevabd;
    
  • You use mysqldump to export all the contents of the old database to a file

  • Now you import the file created in step 2 to the new database

  • Let's see what the commands would look like. Suppose that:

  • the user is root (can be any other with privileges to create databases)
  • the database that exists is called viejabd
  • the new database is called nuevabd
  • Step 1: Create nuevabd :

    We enter with our user:

    >mysql -u root -p
    Enter password: **********  -- aquí debes poner la password del usuario 
    

    We create the new database:

    > CREATE DATABASE nuevabd;
    

    You can check if it has been created:

    > SHOW DATABASES
    

    Step 2: Export the old database to a file .sql

    We assume that the file will be saved in the directory c:\bd

    >mysqldump -u root -p viejabd > c:\bd\viejabd.sql
    Enter password: **********
    

    What this command does is request entry to the bd by user root and export the contents of viejabd in a file called viejabd.sql that will be in the indicated route. The > symbol means export .

    Step 3: We import the file created in step 2 to the new database

    >mysql -u root -p nuevabd < c:\bd\viejabd.sql
    Enter password: **********
    

    Here the operator < means import .

    Then you can verify that everything went as expected

    > SHOW TABLES FROM nuevabd;
    

    It will show you a list of tables in the new database.

        
    answered by 22.03.2018 / 01:48
    source
    0

    to get the data inserted from a table use the option to export, what you must do is in PhpMyAdmin search your database and enter the table where you need to obtain your data, for example I need the records of the table "tbl_estados "found in the sakila database

    once you are in the export tab you click the continue button and you will be downloaded a file name_of_your_table.sql you open it with your code editor and you search for the insert of the table

    and you can use that insert in your new table, as long as it is the same structure

        
    answered by 27.02.2018 в 19:13