Method 1
Log into MySQL cmd line
Change to the folder where you want to save the export file.
Enter the following into the cmd line and replace username with the database username and databasename with the database name:
mysql -u username -p databasename
To save to a csv file enter into the MySQL command line replacing data.sql with the filename
source data.sql;
Method 2
Platform
MariaDB on AlmaLinux 8.5 with Cpanel 104.0.4
You run sql cmd
mysqlimport -u databasesourcefilename.sql
You receive error:
mysqlimport: Error: 1524 Plugin ‘unix_socket’ is not loaded
This issue usual relates to Unix authentication plugin, the quickest fix is to open MariaDB configuration file and add a single line into the file and save. Run the commands below to open MariaDB default configuration file.
nano /etc/my.cnf
Then add the line below [mysqld] section.
plugin-load-add = auth_socket.so
Save and exit
Restart Mysql with
/scripts/restartsrv_mysql
Login to mySQL with
mysql -u root
Running the commands above should logon onto the database without password prompt. that’s because it’s using unix socket authentication.
You are now in the mysQL cmd line. Run
mysql> use databasename;
mysql> source databasesourcefilename.sql;

