NAS Qnap - importare db sql grandi dimensioni

programmazione & dintorni
Rispondi
admin
Site Admin
Messaggi: 205
Iscritto il: dom mar 20, 2016 9:24 pm

NAS Qnap - importare db sql grandi dimensioni

Messaggio da admin »

Importing Databases via Command Line (SSH)

Using SSH can be a superior way to manage the files and databases on your account. Using a simple command you can import a MySQL database into an existing database on your account. If are looking for instructions to export a database, please go to the Exporting Databases via Command Line (SSH) article. If you are looking for instructions for importing and exporting databases using phpMyAdmin, please go to the Export Databases with phpMyAdmin articles.
Note: SSH access is required for this process. Click Here for information about getting SSH access
Using Command Line (SSH) to import your MySQL database

The file must be in .sql format. It can not be compressed in a .zip or .tar.gz file.

Upload the SQL file to the server via the file manager or an FTP client.
If the database does not exist, please create a database, a user, and give the user full privileges to the database. Note the username and password.
If you are unsure how to make a database, please refer to the MySQL Database Creation article.
Log into the server through SSH
Navigate to the directory where your .sql file is.
Type in this command:

/usr/local/mysql/bin/mysql -p -u user_name database_name < file.sql (replace 'user_name', 'database_name', and 'file.sql' with the actual name.)

You will be prompted for your database user password, and then your database will be imported.

nel caso uscisse errore: ERROR 1153 (08S01) at line 96: Got a packet bigger than 'max_allowed_packet' bytes


aprire un terminale
aprire una sessione Mysql con il comando: /usr/local/mysql/bin/mysql -p -u user_name
inserire la password
comparirà il welcome message di Mysql
inserire i seguenti comandi:
set global net_buffer_length=1000000;
Query OK, 0 rows affected (0.00 sec)

set global max_allowed_packet=1000000000;
Query OK, 0 rows affected (0.00 sec)


a questo punto eseguire nuovamente il comando per importare il database

/usr/local/mysql/bin/mysql -p -u user_name database_name < file.sql (replace 'user_name', 'database_name', and 'file.sql' with the actual name.)
---------------------------------------------------------------------------------
Import A MySQL Database
The file must be in .sql format. It can not be compressed in a .zip or .tar.gz file.

Start by uploading the .sql file onto the Bluehost server
If you haven't already done so, create the MySQL database via the cpanel. Click Here for further instructions
Using SSH, navigate to the directory where your .sql file is.
Next run this command:

mysql -p -u username database_name < file.sql

To import a single table into an existing database you would use the following command:

mysql -u username -p -D database_name < tableName.sql

https://my.bluehost.com/cgi/help/161#import
Rispondi