Tag Archives: mysql
ERROR 2002 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)
ERROR 2003 (HY000): Can’t connect to MYSQL Server on ‘localhost’ (10061)
You can see from the error message that the MySQL service is not started, so just start the MySQL service.
Open the task manager
So if I open Mysql,
Restart Mysql again
That’s it.
mysql workbench Error Code: 1046. No database selected Select the default DB to be used
Error Code: 1046. No database selected Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar.

Reason: Database was not selected
Solution: Double-click on the JSTZ post to execute the SQL Script

Thoroughly solve mysql error: 1030,’Got error 28 from storage engine’
The problem is that the server system is full, and the temporary file directory specified by mysql is full, which is roughly what this means.
Now let’s solve the problem that /dev/vda1 is full, and I actually have no idea where /dev/vda1 is or what it is, but I later learned that this is a virtio-block type device.
Talk about it:
A line beginning with ‘c’ indicates that the device is a character device, and a line beginning with ‘b’ indicates that it is a block device.
/dev/vda and /dev/vDB are both virtio-block devices, while /dev/sda is an SD, or SCSI, device.
On the whole!
First login server: Execute DF-H means:
Check the disk usage space of a server, and find that the disk has been used 100%(this is the graph after I solved the problem, it has been restored to normal, the remaining 42% is enough).
1, CD to the root directory, du-sh * to see which directory takes up a lot of space, some up to a dozen G, so you should keep an eye on this directory
2, CD takes up a lot of memory directory, continue du-sh *
Found data directory incredibly 15G, enter the data directory: CD data
Then look for the large file:
File search command:
find -size +100M
This means to find files larger than 100M. M is Megabyte
You can also query the folder footprint to show the total space occupied by the directory:
Use: DU-h –max-depth=1/path
For example, du-h –max-depth=1 /var
This is to see which folder takes up the most memory in the directory
If you want to locate a large file:
ls -lhS
This is to display the file from large to small
3. Repeat the first two steps and decide whether to delete or remove them according to the actual situation
4. You can clear the log if it is too large
Run command:
cat /dev/null > file.log
Pro test, catalina.out in mysql folder can be deleted, execute:
echo “” > catalina.out
This log file is usually large.
5, if the package is too large, do not need to be able to uninstall
Perform unload
Rmp-e software name
Or delete
Rm-rf folder name
6, the large file is almost deleted, again DF-H, disk space can be reserved for a little half, absolutely perfect solution to the mysql 1030 problem!
MySQL Workbench: Error Code: 2013. Lost connection to MySQL server during query solution
Solutions:
Edit-> Preference-> SQL Editor
Appropriately increase the FOLLOWING DBMS Connection Read Time out(in seconds) :

Resources:
http://bbs.csdn.net/topics/391881939?page=1
https://dev.mysql.com/doc/refman/5.7/en/error-lost-connection.html
Mysql reports an error Operand should contain 1 column(s)
Mysql error Operand should contain 1 column(s)
1. An error
ERROR 1241 (21000): Operand should contain 1 column(s)
2. Report the cause of the error
This statement mostly occurs because the result set of the SELECT is wrapped in (). It is normal to enclose ()
with select
, but it is possible that the fields are misused, as shown in the following SQL:
select
pit_key
,employee_code
,department_id
,value_date
from pit_employee_department ped
where ped.employee_code = 'GSCQ3349'
and ped.value_date < date_format(date_sub(curdate(), interval day(curdate()) - 1 day),'%Y%m%d')
and ped.pit_key not in
( select
pit_key
,value_date
from pit_employee_department ped_1
inner join
(
select
max(value_date) as max_date
from pit_employee_department ped
where ped.value_date <= date_format(date_sub( date_sub(curdate(), interval day(curdate()) - 1 day),interval 1 month),'%Y%m%d')
and employee_code = 'GSSH0039'
)ped_2
on ped_1.value_date < ped_2.max_date
and ped_1.employee_code = 'GSSH0039'
);
The reason for executing this error in the above SQL statement is that pit_key
and value_date
are used in the subquery, and the comparison option is pit_key not in (...).
, field inconsistency results in an error.
3. Solutions
Make changes for different reasons.
Node.JS “Cannot enqueue Handshake after invoking quit” Error (Fixed)
module.exports = {
getDataFromUserGps: function(callback)
{
connection.connect();
connection.query("SELECT * FROM usergps",
function(err, results, fields) {
if (err) return callback(err, null);
return callback(null, results);
}
);
connection.end();
},
loginUser: function(login, pass, callback)
{
connection.connect();
connection.query(
"SELECT id FROM users WHERE login = ?AND pass = ?",
[login, pass],
function(err, results, fields)
{
if (err) return callback(err, null);
return callback(null, results);
}
);
connection.end();
},
getUserDetails: function(userid, callback)
{
connection.connect();
connection.query(
"SELECT * FROM userProfilDetails LEFT JOIN tags ON userProfilDetails.userId = tags.userId WHERE userProfilDetails.userid = ?",
[userid],
function(err, results, fields)
{
if (err) return callback(err, null);
return callback(null, results);
}
);
connection.end();
},
addTags: function(userId, tags)
{
connection.connect();
connection.query(
"INSERT INTO tag (userId, tag) VALUES (?, ?)",
[userId, tags],
function(err, results, fields)
{
if (err) throw err;
}
)
connection.end();
}
}
Everything worked fine at first, but when I executed the second “query, “I got this error:
Cannot enqueue Handshake after invoking quit
I’ve tried turning off the connection without using the.end() method, but it doesn’t work.
Thanked first.
Radex
Those blind solutions and water paste I will not translate.
According to:
Fixing Node Mysql “Error: Cannot enqueue Handshake after invoking quit.”:
http://codetheory.in/fixing-node-mysql-error-cannot-enqueue-handshake-after-invoking-quit/
TL; Every time DR closes a connection you need to create a new connection using the createConnection method.
And
Note: If you are serving web requests, you should not turn off the connection each time the request is processed. When the server starts up, create a connection and keep querying it with the Connection/Client object. To handle server disconnection and reconnection events you can listen for error events. Complete code: Here.
Again according to:
The Readme. Md – Server disconnects:
https://github.com/felixge/node-mysql#server-disconnects
It said
Server disconnects
You may lose your connection to MySQL server due to a network problem, server timeout, or server hanging. All of these are considered “fatal errors “and there will be an error codeerr. Code = 'PROTOCOL_CONNECTION_LOST'
. See the error handling section for more information.
The best way to handle these unwanted disconnections is as follows:function handleDisconnect(connection) { connection.on('error', function(err) { if (!err.fatal) { return; } if (err.code !== 'PROTOCOL_CONNECTION_LOST') { throw err; } console.log('Re-connecting lost connection: ' + err.stack); connection = mysql.createConnection(connection.config); handleDisconnect(connection); connection.connect(); }); } handleDisconnect(connection);
As the example above shows, reconnection is achieved by creating a new connection, because the connection object is designed so that it cannot be reconnected once it dies.
When a connection pool is used, suspended connections are removed from the pool and space is freed, and a new connection is automatically created when a new connection request arrives.
the respondent has posted his own autoreconnect code at the end, so I’m not going to post it here.The answer was 18:58 on May 3, 2013
XP1
Although this answer was not adopted by the main topic, but I and the following comments have always thought that this answer is better.
The original web site: http://stackoverflow.com/questions/14087924/cannot-enqueue-handshake-after-invoking-quit
mysql Error Code: 1022. Can’t write; duplicate key in table `xxx`
The database looks at all the foreign keys to verify whether a foreign key already exists (mysql).
Find duplicate foreign key names, where used, SQL as follows:
select * from INFORMATION_SCHEMA.KEY_COLUMN_USAGE where CONSTRAINT_NAME='NAME'
If no problem, rename it
Thank you
mysql ERROR 1025 (HY000): Error on rename of
MySQL startup problem (ERROR 1045 (28000): Access denied for user’ODBC’@’localhost’ (using password: NO))
The solution is as follows:
(1) open mysql service because I installed the selected manual boot at that time.
(2) add the bin directory of mysql installation to the system PATH environment variable, using; (semicolon) partition.
(3) then open CMD and type the command: mysql-u username -p password. Enter mysql-u root-p my root password on my machine, and you will be able to enter mysql.
As shown in the figure below:

Reset password:
$mysql -u root -p
login password # mysql server mysql> Use mysql # using mysql database
mysql> Update user set password= password (“123456”) where user =’root’ # update user password
mysql> Flush privileges # to refresh the permissions
mysql> Quit # Quit the mysql server
Fatal error: Please read “Security” section of the manual to find out how to run mysqld as root!
The root of the problem is mysql installed by root and started by default./mysqld Restart reports the following error;
Mysql installation directory is: /usr/local/mysql/
[root@SHB-L0120796 bin]# ./mysqld restart
2020-03-06T09:02:19.361027Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-03-06T09:02:19.361168Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2020-03-06T09:02:19.361213Z 0 [Note] ./mysqld (mysqld 5.7.27) starting as process 29670 ...
2020-03-06T09:02:19.364761Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2020-03-06T09:02:19.364806Z 0 [ERROR] Aborting
2020-03-06T09:02:19.364835Z 0 [Note] Binlog end
2020-03-06T09:02:19.367170Z 0 [Note] ./mysqld: Shutdown complete
Temporary solutions:
Root /mysqld –user=root start in the installation directory /usr/local/mysql/bin using root:./mysqld –user=root start
./mysqld --user=root start
Or try /usr/local/mysql/bin under the installation directory:
service mysqld start
Best solution: Without modifying the my.cnF file, execute the following command line
./mysqld --skip-grant-tables --skip-networking --user=root &
Mysql error when deleting the table structure: Error Code: 1217. Cannot delete or update a parent row: a foreign key constraint fails
Set FOREIGN_KEY_CHECKS = 0; Turn off the Foreign Key inspection
Drop table Table_Name;
The Set FOREIGN_KEY_CHECKS = 1; Resume Foreign Key inspection