mysql import sql file

mysql import sql file

sudo mysql -uroot -p123456 -h127.0.0.1
sudo mysql -uroot -p123456 -h127.0.0.1

Then

show databases;

Then use database name;
then

source 20230920031001.sql;

If you do not add -h127.0.0.1,
the error /var/lib/mysql.sock error may occur.

Importing through navicat will result in about 20G of log files appearing in /var/log. I am not sure whether this 20G is accumulated or caused this time.

Create database


create database youdb default character set utf8mb4 collate utf8mb4_bin;

Insert image description here

For example, to create a database named test, you can use the following command:

Create database test;

If you want to create a database named test, but only if the database does not exist, you can use the following command:

Create database if not exists test;

If you want to create a database named test and specify its character set as utf8, you can use the following command:

Create database test charset utf8;

Special note: Please use utf8mb4 for Chinese! Please use utf8mb4 for Chinese! Please use utf8mb4 for Chinese!

Insert image description here
It was slow at first, with a 26G data import taking 5 or 6 seconds from 2:30 yesterday to around 9am.
Total 9 + 10 = 19 hours.

Guess you like

Origin blog.csdn.net/wowocpp/article/details/133029882