Category Archives: MYSQL

How to Solve MySQL Secure file priv error

Problem description

When I want to export data in mysql, I find an error. The error contents are as follows

The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

Principle interpretation

secure file priv is a system variable in MySQL that controls the operation of importing and exporting data, such as load data or select... Into output or load_FILE()

Use show global variables like 'secure_File% ' view the set value of this variable, which may have the following three values

  1. no value. That is, this variable has no effect

2﹥ point to a path. That is, import and export can only use this path

three ⃣ ️ NULL。 Import and export operations are prohibited

The default value of this system variable is different for different platforms

terms of settlement

Environment: MySQL 8.0.26 (installed with homebrew ), macbook pro 2020 Intel Edition

one ⃣ Create corresponding files, ~ /.My.CNF , and use your customary text editor. I use nano , which contains the following contents

secure_file_priv = ''

two ⃣ Restart the MySQL service and log in

brew services stop mysql
brew services start mysql

mysql -uroot -p           

3﹥ check whether the modification is successful in MySQL,

show global variables like 'secure_file%';

# If the modification is successful it should display the following, showing a null value
| Variable_name    | Value |
| secure_file_priv |       |
1 row in set (0.00 sec)



[Solved] MySQL Error: com.mysql.cj.jdbc.util.TimeUtil.loadTimeZoneMappings(


Mysql database version 5.6, jdbc driver package mysql-connector-java-5.1.49-bin version, start tomcat, and an error is reported when connecting to the database. Details:


After query, it is said that the exception is thrown because the format of the MySQL server time zone (inherited from the system time zone) is different from that expected by the MySQL connector.


Add the JDBC URL to the servertimezone, for example:


servertimezone = UTC , where UTC is the unified standard world time; China is in the East eighth district. If you need to specify the time zone as China, you can modify the configuration to servertimezone = GMT% 2B8 .

About time zone:

UTC, coordinated universal time. UTC is a time measurement system based on atomic time and second length, which is as close as possible to GMT in time. To ensure that UTC does not differ from GMT by more than 0.9 seconds, positive or negative leap seconds will be added to UTC if necessary. UTC is now used as world standard time
GMT: Greenwich mean time, that is, universal time. Noon in GMT refers to the time when the sun crosses the Greenwich meridian (primary meridian). However, due to the uneven and irregular rotation of the earth, GMT is not accurate, and it is no longer used as the world standard time
UTC is basically the same as GMT, with an error of no more than 0.9 seconds

[Solved] Hive export MYSQL Error: Container [pid=3962,containerID=container_1632883011739_0002_01_000002] is running 270113280B beyond the ‘VIRTUAL’ memory limit.

Problem description

Container [pid=3962,containerID=container_1632883011739_0002_01_000002] is running 270113280B beyond the ‘VIRTUAL’ memory limit.

Current usage: 91.9 MB of 1 GB physical memory used; 2.4 GB of 2.1 GB virtual memory used. Killing container.

Cause of problem

When yarn starts running, it checks the virtual memory and throws an exception.


Modify Hadoop_Home/etc/Hadoop/yen-site.xml file

Add the following to save and exit:

1 <property>
2 <name>yarn.nodemanager.vmem-pmem-ratio</name>
3 <value>3.0</value>
4 </property>

Problem solved!

How to Solve Client does not support authentication protocol requested by server; Consider upgrading MySQL

Today, the server deployed node.js + MYSQL, and the calling interface reported an error er_ NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

After checking the information, I changed two places

1. Server security group policy is configured and 3306 port is added

2. I modify the MySQL encryption rules to normal mode, and the default is strict encryption mode

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的数据库密码';

The operation steps are as follows: then restart node.js to test

It’s done~


[Solved] MYSQL8 Error: ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)

1:stop serves: net stop mysql
2:remove serves: mysqld -remove mysql
3:E:\zyf\mysql8\bin>mysqld -initialize-insecure -user=mysql
4:E:\zyf\mysql8\bin>mysqld -install mysql
5:E:\zyf\mysql8\bin>net start mysql
Error: ERROR 1045 (28000): Access denied for user ‘ODBC’@’localhost’ (using password: NO)
7:E:\zyf\mysql8\bin>mysql -uroot -p
Enter password: *******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10  Then you can log in normally!
If you encounter Navicat can’t connect to mysql service: Error reported.

You can start by logging into mysql in a DOS command window at
Then run: mysql> ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘root123’;
Query OK, 0 rows affected (0.07 sec)
Then you can log in normally.

Oracle executes SQL script file with command

When there are too many SQL commands (the SQL file is too large), the execution of PLSQL is slow and easy to timeout. At this time, you can directly execute the SQL script file with sqlplus command, as follows:

1. Sqlplus login

> sqlplus username/ [email protected]

2. Execute SQL file

If the SQL file is in the current directory, you can directly execute:

>@ demo.sql

If the SQL file is not in the current directory, you can use the absolute path:

>@ D:/demo.sql

How to Solve Navicat Remote Connection to MySQL is Stuck

Developing an application system to connect to the MySQL database of the company’s test server is very slow, but connecting to the local MySQL database is very fast. At first, it was thought that it may be caused by network connection problems. After Ping and routing, it was found that the network communication is normal, and the local connection on the MySQL machine is very fast, Therefore, the network problem has been basically eliminated, so I want to see if it is a MySQL configuration problem. After querying MySQL related documents and network search, it seems that a configuration can solve such a problem, that is, add the following configuration parameters to the MySQL configuration file:


Under Linux, the configuration file is/etc/my.cnf. Under windows, the configuration file is my.ini file under MySQL installation directory. Note that the configuration is added under [mysqld]. After changing the configuration and saving it, restart MySQL and conduct remote connection test. Everything is restored as before.

How to Backup MySQL database regularly

Requirement: regularly back up MySQL specific database


MySQL socket path;

# netstat -ln | grep mysql
unix  2      [ ACC ]     STREAM     LISTENING     37194    /tmp/mysql.sock

Backup command, named after dbname + date:

mysqldump --socket=/tmp/mysql.sock -u root -ppassword dbname > dbname_back_`date +%F`.sql

Mount to the public disk, there is no need for SCP;

Prepare the SH file, back up DB to a specific path, package it, and delete the backup for more than 30 days:

d=`date +%F`

mysqldump --socket=/tmp/mysql.sock -u root -ppassword dbname > $backdir/dbname_back_$d.sql

cd $backdir
gzip *_$d.sql
find ./ -name "*.gz" -mtime +30 |xargs rm

Set sh file as executable:

chmod +x /mnt/backup_db/

Determine the backup frequency and execute it at 7:59 a.m. every Friday;

# crontab -e
59 07 * * 5 /bin/bash /mnt/backup_db/ >/tmp/mysql_backup.log 2>/tmp/mysql_backup.log