Skip to content

Malformed packet error #844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
81698 opened this issue Aug 8, 2018 · 5 comments · Fixed by #870
Closed

Malformed packet error #844

81698 opened this issue Aug 8, 2018 · 5 comments · Fixed by #870
Labels
Milestone

Comments

@81698
Copy link

81698 commented Aug 8, 2018

Issue description

Tell us what should happen and what happens instead
Expected this to open a connection and return a 1 from the database. Instead got a malformed packet error.
Works in v1.3.0

Example code

If possible, please enter some example code here to reproduce the issue.
func TestAQuery(t *testing.T) {
    db, err := sql.Open("mysql", "username:password@/database?allowOldPasswords=1")
    if err != nil {
        t.Fatal(err)
    }
    defer db.Close()
    var id int
    if err := db.QueryRow("SELECT 1").Scan(&id); err != nil {
        t.Fatal(err)
    }
}

Error log

If you have an error log, please paste it here.
malformed packet

Configuration

Driver version (or git SHA):
v1.4.0

Go version: run go version in your console
go version devel +15c106d Tue Aug 7 20:33:33 2018 +0000 linux/amd64

Server version: E.g. MySQL 5.6, MariaDB 10.0.20
5.5.59-MariaDB

Server OS: E.g. Debian 8.1 (Jessie), Windows 10
14.04.1-Ubuntu

@methane
Copy link
Member

methane commented Aug 9, 2018

Could you dump packets by tcpdump?
tcpdump can be used to dump packets to pcap file which can be browsed by wireshark.

e.g. sudo tcpdump port 3306 -w dump.pcap

@mqy
Copy link

mqy commented Aug 10, 2018

Similar problem on 5.5.35-MariaDB with latest code (99ff426) and v1.4.0. Failed with parameters:

  • query_cache_type=0
  • allowOldPasswords=true
  • allowCleartextPasswords=true

But works with the following commit without above parameters:

commit 02eb68a
Author: Alexey Palazhchenko [email protected]
Date: Sat Mar 3 19:06:37 2018 +0300

@methane
Copy link
Member

methane commented Oct 5, 2018

Do you use old password?

@methane
Copy link
Member

methane commented Oct 5, 2018

Even MySQL client shows "malfold packet" error.

$ mysql -uroot -h127.0.0.1 -P3306
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.61-MariaDB-1~trusty mariadb.org binary distribution

mysql> create user test1;
Query OK, 0 rows affected (0.00 sec)

mysql> set password for test1 = OLD_PASSWORD('secret');
Query OK, 0 rows affected (0.00 sec)

mysql> ^DBye

$ mysql -utest1  -h127.0.0.1 -P3306 -psecret
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2027 (HY000): Malformed packet

@dwlnetnl
Copy link

I encounter this issue as well.

methane added a commit to methane/mysql that referenced this issue Oct 15, 2018
@julienschmidt julienschmidt added this to the v1.4.1 milestone Oct 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants