Archives

Error while sending QUERY packet

This error means that the MySQL/MariaDB server is not able to process the request. You will see in the error_log files entries like:

[21-Feb-2020 21:34:00 UTC] PHP Warning:  Error while sending QUERY packet. PID=4697 in /home/flighting/public_html/wp-includes/wp-db.php on line 2030
[21-Feb-2020 21:34:00 UTC] PHP Warning:  Error while sending QUERY packet. PID=4726 in /home/flighting/public_html/wp-includes/wp-db.php on line 2030
[21-Feb-2020 21:34:00 UTC] PHP Warning:  Error while sending QUERY packet. PID=4734 in /home/flighting/public_html/wp-includes/wp-db.php on line 2030
[21-Feb-2020 21:34:19 UTC] PHP Warning:  Error while sending QUERY packet. PID=4734 in /home/flighting/public_html/wp-includes/wp-db.php on line 2030
[21-Feb-2020 21:34:19 UTC] PHP Warning:  Error while sending QUERY packet. PID=4726 in /home/flighting/public_html/wp-includes/wp-db.php on line 2030
[21-Feb-2020 21:34:19 UTC] PHP Warning:  Error while sending QUERY packet. PID=4697 in /home/flighting/public_html/wp-includes/wp-db.php on line 2030

This issue can happen during a site/server attack. Because of the huge number of requests, at some point, the SQL server might be killed, or it can produce errors.

Error while sending QUERY

Another cause can be the server configuration. Some hosts limit the maximum number of database requests in a specific time interval.

In any case, it’s a server thing, and you should ask your host about the warnings.

A server admin should check the database – if there are any tables that need to be repaired. You can check our article on how to optimize MySQL/MariaDB tables.

Export a MySQL/MariaDB database

Exporting a database can be done very easily from phpMyAdmin/ from your web hosting control panel (cPanel, DirectAdmin, VestaCP etc). But you can also export databases from the command line with the mysqldump utility.

With mysqldump you can export a single database, all databases or a list of databases:

shell> mysqldump [options] db_name [tbl_name …]
shell> mysqldump [options] –databases db_name …
shell> mysqldump [options] –all-databases

mysqldump help page

To backup one database, use the command below. It will save the database as an SQL file.

mysqldump -u db_user -p db_name > db_name.sql

If you are running the commands as root, you don’t need the -u, -p parameters.

root@web [~]# mysqldump admin_wp74 > admin_wp74.sql
root@web [~]# 

If you want to archive the exported database to save space, use:

mysqldump -u db_user -p db_name | gzip > /home/db_name.sql.gz

root@web [~]# mysqldump admin_wp74 | gzip > /root/admin_wp74.sql.gz
root@web [~]#

Resources:
mysqldump help

Top five software applications to access MySQL/MariaDB servers

To manage a MySQL/MariaDB from web you can use the well-known phpMyAdmin script (available from cPanel, from Softaculous etc). But what happens if you want to use a Windows/Linux/Mac program to manage your databases? We will list here some programs that allow you to work with databases. With these programs you can connect to a local MySQL server or to a remote one. Also, all these programs have GUI – graphical user interface.

Notice that most web hosts block MySQL/MariaDB port 3306. Ask your host to add an exception in the firewall for your IP.

The best option is to download and test each of them to see which one do you like the most. So, in no particular order:

1.SQLyog

SQLyog is the most powerful MySQL administration tool for DBAs, developers and database architects.

sqlyog
SQLyog Window – Click image to enlarge

Homepage: SQLyog
Price: from $99($69 license+ $30 support); free updates for 1 year.
Info:
– strong/well-known product
– no Linux/Mac version; only Windows (32/64 bit) version available.

2.MySQL Workbench

MySQL Workbench is a unified visual tool for database architects, developers, and DBAs. MySQL Workbench provides data modeling, SQL development, and comprehensive administration tools for server configuration, user administration, backup, and much more.

MySQL Workbench
MySQL Workbench Window – Click image to enlarge

Homepage: MySQL Workbench
Price: FREE
Info:
– developed by MySQL/Oracle
– has versions for Windows (32/64 bit), Linux, Mac
– can’t use it with MariaDB anymore

3.HeidiSQL

HeidiSQL is a useful and reliable tool designed for web developers using the popular MySQL server, Microsoft SQL databases and PostgreSQL. It enables you to browse and edit data, create and edit tables, views, procedures, triggers and scheduled events.

HeidiSQL
HeidiSQL Window – Click image to enlarge

Homepage: HeidiSQL
Price: FREE
Info:
– free software; you can download installer/portable exe/source code
– no Linux/Mac version; only Windows (32/64 bit) version available.

4.Navicat for MySQL(Support MariaDB)

Navicat for MySQL is the ideal solution for MySQL/MariaDB administration and development. Connect to MySQL and MariaDB databases simultaneously within a single application. This all-inclusive front-end provides an intuitive and powerful graphical interface for database management, development, and maintenance. It delivers a comprehensive set of tools for those new to MySQL/MariaDB as well as professional developers.

Navicat for MySQL
Navicat for MySQL Window – Click image to enlarge

Homepage: Navicat for MySQL
Price: from $169
Info:
– available for Windows (32/64 bit), Mac, Linux

5.dbForge Studio for MySQL

dbForge Studio for MySQL is a universal GUI tool for MySQL and MariaDB database administration, development, and management. The IDE allows to create and execute queries, develop and debug stored routines, automate database object management, analyze table data via an intuitive interface.

dbForge Studio for MySQL
dbForge Studio for MySQL – Click image to enlarge

Homepage: dbForge Studio for MySQL
Price: FREE and Paid from $119.95 (support and upgrades for 1 year)
Info:
– no Linux/Mac version

Working with cPanel MySQL Databases

cPanel allows you to easily manage your databases and users.

Necessary steps to add a new database:

  1. Log in to cPanel
  2. Look for MySQL® Databases (DATABASES section)
  3. Look for Create New Database section. Enter your desired database name and click the Create Database button. The database will be created, a confirmations message will be displayed: Added the database “database_name”.

To check/repair a database:

  1. Log in to cPanel
  2. Look for MySQL® Databases (DATABASES section)
  3. Go the Modify Databases section
  4. Select from the drop-down list the database you want to check(or repair).
  5. Click the Check(or Repair) Database button. In case of issue, you will see them. In case everything is fine, a success message will be displayed: Success: Check/Repair Complete!

To add a new user to the MySQL/MariaDB server:

  1. Log in to cPanel
  2. Look for MySQL® Databases (DATABASES section)
  3. Go the Modify Databases section
  4. Look for MySQL Users->Add New User section
  5. Enter the Username and Password.
  6. Click the Create User button. The new user will be created, you will see a confirmation message: You have successfully created a MySQL user named “username”.

To add a user to a database:

  1. Log in to cPanel
  2. Look for MySQL® Databases (DATABASES section)
  3. Go the Modify Databases section
  4. Look for MySQL Users->Add User To Database section
  5. Choose the User and the Database from the two drop-down lists.
  6. Click the Add button.
  7. Choose the privileges you want to give to the user.
  8. Click the Make Changes button.
cPanel Databases
cPanel Databases
Notice that you can use this tool for both MySQL and MariaDB servers.

Related KB: How to use the cPanel MySQL Database Wizard

How to use the cPanel MySQL Database Wizard

With the cPanel MySQL Database Wizard you can easily create a database and set up a user for it.

How to use the MySQL Database Wizard:

  1. Log in to your cPanel account
  2. Go to MySQL Database Wizard (DATABASES section)
  3. Step1. Enter the new database name . Click the Next Step button.
  4. Step2. Enter the Username and the Password you want. (you can use the Password Generator) Click the Create User button.
  5. Step3. Now we need to add the user to the database. Select the privileges you want the new user to have on the database. Select ALL PRIVILEGES.  You can also select specific privileges, as:
    ALTER CREATE CREATE TEMPORARY TABLES
    DELETE EVENT INDEX
    ALTER ROUTINE CREATE ROUTINE CREATE VIEW
    LOCK TABLES SELECT TRIGGER
    DROP EXECUTE INSERT
    REFERENCES SHOW VIEW UPDATE

    Click the Next Step button.

  6. Step 4. Nothing to do here. Everything is completed.
cPanel MySQL Database Wizard
cPanel MySQL Database Wizard

 

The how-to movie:

Related KB: Working with cPanel MySQL Databases

Page 1 of 2
1 2