We recently upgraded from MySQL 5.1.41 to 5.1.61 on our Ubuntu 10.04LTS server. We have an ancient RoR web app that’s now giving a bad handshake error:
Mysql::Error in MainController#index
#08S01Bad handshake
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/vendor/mysql.rb:523:in `read'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/vendor/mysql.rb:153:in `real_connect'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:389:in `connect'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:152:in `initialize'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:82:in `new'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:82:in `mysql_connection'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:262:in `send'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:262:in `connection_without_query_cache='
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/query_cache.rb:54:in `connection='
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:230:in `retrieve_connection'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:763:in `columns'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:2060:in `attributes_from_column_definition_without_lock'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/locking/optimistic.rb:45:in `attributes_from_column_definition'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1502:in `initialize_without_callbacks'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/callbacks.rb:225:in `initialize'
#{RAILS_ROOT}/app/controllers/application.rb:48:in `new'
#{RAILS_ROOT}/app/controllers/application.rb:48:in `log_info'
/usr/local/bin/mongrel_rails:19:in `load'
/usr/local/bin/mongrel_rails:19
I googled around and stumbled onto http://bugs.ruby-lang.org/issues/5017 which tells me it’s a Ruby MySQL extension bug. We aren’t using the MySQL gem. Our web app is incredibly old and fragile (Ruby v1.8.7, Rails v1.2.3, Mongrel 1.1.5). We’re in the process of replacing it with a Django rewrite, so we just need to get this functional for the next few weeks until we will replace it with the new site.
How can we get past this error? I’m thinking that downgrading to MySQL 5.1.41 is the best way to handle this, and then when we begin using the new site in a few weeks, we can re-upgrade to 5.1.61. However, I’m having an issue downgrading mysql. This is the command I’m using:
sudo aptitude install mysql-server-5.1=5.1.41-3ubuntu12.10
However, this tells me Unable to find a version "5.1.41-3ubuntu12.10" for the package "mysql-server-5.1"
. I’ve tried sudo aptitude install mysql-server-5.1=5.1.41
also, but that didn’t work either. How can I have aptitude install the correct version of MySQL?
Bug description
Hi, I’ve been trying to set up SSL for my prisma connection but I’m getting a «Bad Handshake» error, even though on MySQL Workbench, tableplus… my connection works fine with certificates.
I’ve followed the guide on the prisma docs website here. And placed both client-identity.p12 and rootca.cert inside my ./prisma folder.
The connection string i’m using is:
'mysql://user:password@ip:port/database?sslidentity=client-identity.p12&sslpassword=mypassword&sslcert=rootca.cart'
Prisma information
generator client { provider = "prisma-client-js" } datasource db { provider = "mysql" url = env("DATABASE_URL") }
Environment & setup
Trying to connect to: MySQL Server V8.0.31 @ Ubuntu 22.04
Prisma Version
prisma : 4.7.1
@prisma/client : 4.7.1
I’m having problem to connect to the remote DB from the terminal as follow
mysql -u db_user -p -h 10.100.1.100
Enter password:
afer entering password I’m getting that error:
ERROR 1043 (08S01): Bad handshake
and I can connect to the DB from a PC using MySQL Workbench.
Running MySQL Ver 14.14 Distrib 5.1.73 for CentOS6
asked Jun 28, 2019 at 20:21
There is old Bug Report about MySQL Workbench connecting to older databases.
- Bug #91828 : Bad handshake since 8.0.12
Others have come across this
- Can’t connect to MySQL server on MySQLCC ERROR 1043 Bad Handshake
- SOLVED: Bad Handshake – MySQL Workbench Failed To Connect To SQL
- Devart Forums : Bad Handshake
When you google the subject of «mysql bad handshake», you will see two basic issues:
- Older Versions of MySQL
- Older Versions of ODBC/JDBC Drivers
The second post I referred to actually recommends «dummying down» and using an older product (MySQL Administrator for you Old School DBAs like myself).
Main thing to do is to make sure your drivers match the version of Workbench you are using. BTW Don’t feel bad about using MySQL 5.1. There are still a lot of die-hards out there that are using (I hope you sitting down), MySQL 3.23.58.
WHAT TO DO
Use Older Versions of MySQL Workbench, Navicat, SquirrelSQL.
Hey, that worked in the second post (Click Here for Those Tools)
Please remember that MySQL 5.1 made allowances for MySQL 4.1 password authentication. Newer ODBC/JDBC drivers may not understand MySQL 5.1’s way of authenticating and other network-related things, colloquially called «BAD HANDSHAKE».
answered Jun 28, 2019 at 22:42
RolandoMySQLDBARolandoMySQLDBA
179k32 gold badges310 silver badges511 bronze badges
I am able to connect to the remote DB using «mysql -h -u’root’ option. The remote db has no password for root. But when I use Net::MySQL it throws a _#08S01Bad handshake error_
.
my $mysql = Net::MySQL->new(
hostname => '<ip>',
database => '<db>',
user => 'root',
password => ''
);
The SQL version of the local machine is 5.5.44. I was able to connect to the same remote DB(mysql ver 5.0.45) using the same code from a different machine(mysql ver 5.0.24).
I’m having problem to connect to the remote DB from the terminal as follow
mysql -u db_user -p -h 10.100.1.100
Enter password:
afer entering password I’m getting that error:
ERROR 1043 (08S01): Bad handshake
and I can connect to the DB from a PC using MySQL Workbench.
Running MySQL Ver 14.14 Distrib 5.1.73 for CentOS6
asked Jun 28, 2019 at 19:54
6
Is connector are compatible with your version? (if you upgraded db recently this may be case) Or Possibly bug try with upgraded version on both db and connector. I can see some similar bugs on mysql portals. Bad handshake most of the time mean both master and clients are not compatible.
answered Jun 29, 2019 at 4:58
asktyagiasktyagi
2,6611 gold badge7 silver badges23 bronze badges
The following error message appears when connecting to the database and how to solve it:
The error message is that the port is the default port number of MySQL, which is occupied so that it cannot connect to the database
The steps to solve the problem of port occupation are as follows:
win+R -> Run -cmd, enter netstat -ano in the console, find the port number 3306, and remember the corresponding PID
Then open the task manager -> view -> select the column -> tick PID (process identifier) -> OK
Find the PID process in the task manager, check what program is occupying the port, and close it
Then restart mysql to avoid the error that the packet port is occupied
Reference article:
I can’t connect to my server221 with MySQLCC and also through my webpage. I have managed to connect to server 253 with no errors. I am not sure what is wrong but I keep getting the error 1043 bad handshake. I am positive that all my userID and password are keyed in correctly. I can even ping the server 192.168.0.221
I am changing PC and on my previous PC, I have managed to connect to the server221 flawlessly with the same settings. I don’t know where to even start debugging. Please help.
asked Apr 11, 2018 at 5:03
Make sure the version that the server installed is the same as your ODBC Connector at your PC. For example is your server installed 5.7.16 MySQL. Then you have to installed the 5.7.16 ODBC Connector that comes with the msi file. Don’t go to the web and download the latest ODBC connector. I will not work
answered Apr 12, 2018 at 2:10
Hanz CheahHanz Cheah
8314 gold badges15 silver badges43 bronze badges
1
This type of error comes with Mysql server
5.1 or older with versions, you need to update your MySQL server version
.
answered Dec 27, 2018 at 7:27
1
I had this message when trying to copy a table from one database to another on the same host using SQLYog community. I just had to restart the application in that case.
answered Nov 10, 2021 at 11:24
8a98a9
4845 silver badges11 bronze badges
I’m having problem to connect to the remote DB from the terminal as follow
mysql -u db_user -p -h 10.100.1.100
Enter password:
afer entering password I’m getting that error:
ERROR 1043 (08S01): Bad handshake
and I can connect to the DB from a PC using MySQL Workbench.
Running MySQL Ver 14.14 Distrib 5.1.73 for CentOS6
asked Jun 28, 2019 at 20:21
There is old Bug Report about MySQL Workbench connecting to older databases.
- Bug #91828 : Bad handshake since 8.0.12
Others have come across this
- Can’t connect to MySQL server on MySQLCC ERROR 1043 Bad Handshake
- SOLVED: Bad Handshake – MySQL Workbench Failed To Connect To SQL
- Devart Forums : Bad Handshake
When you google the subject of «mysql bad handshake», you will see two basic issues:
- Older Versions of MySQL
- Older Versions of ODBC/JDBC Drivers
The second post I referred to actually recommends «dummying down» and using an older product (MySQL Administrator for you Old School DBAs like myself).
Main thing to do is to make sure your drivers match the version of Workbench you are using. BTW Don’t feel bad about using MySQL 5.1. There are still a lot of die-hards out there that are using (I hope you sitting down), MySQL 3.23.58.
WHAT TO DO
Use Older Versions of MySQL Workbench, Navicat, SquirrelSQL.
Hey, that worked in the second post (Click Here for Those Tools)
Please remember that MySQL 5.1 made allowances for MySQL 4.1 password authentication. Newer ODBC/JDBC drivers may not understand MySQL 5.1’s way of authenticating and other network-related things, colloquially called «BAD HANDSHAKE».
answered Jun 28, 2019 at 22:42
RolandoMySQLDBARolandoMySQLDBA
177k32 gold badges308 silver badges506 bronze badges
Содержание
- Ошибка при соединении: «Error 1043: Bad Handshake»
- Сообщения 2
- 1 Тема от shaman 2007-01-30 14:12:37
- Тема: Ошибка при соединении: «Error 1043: Bad Handshake»
- 2 Ответ от Lokki 2007-01-30 22:44:31
- Re: Ошибка при соединении: «Error 1043: Bad Handshake»
- Сообщения 2
- MySQL «bad handshake» after entering password
- 1 Answer 1
- WHAT TO DO
- Ошибка при соединении: «Error 1043: Bad Handshake»
- Сообщения 2
- 1 Тема от shaman 2007-01-30 14:12:37
- Тема: Ошибка при соединении: «Error 1043: Bad Handshake»
- 2 Ответ от Lokki 2007-01-30 22:44:31
- Re: Ошибка при соединении: «Error 1043: Bad Handshake»
- Сообщения 2
Форум PHP-MyAdmin.RU → MySQL & phpMyAdmin → Ошибка при соединении: «Error 1043: Bad Handshake»
Чтобы отправить ответ, вы должны войти или зарегистрироваться
Сообщения 2
1 Тема от shaman 2007-01-30 14:12:37
- shaman
- Новичок
- Неактивен
- Зарегистрирован: 2007-01-30
- Сообщений: 1
Тема: Ошибка при соединении: «Error 1043: Bad Handshake»
При подключении к mysql выдается ошибка:
#1043 — Bad handshake
PHP 5.2.0, MySQL 5.0.27
2 Ответ от Lokki 2007-01-30 22:44:31
- Lokki
- Админ
- Неактивен
- Откуда: Москва
- Зарегистрирован: 2006-01-25
- Сообщений: 910
Re: Ошибка при соединении: «Error 1043: Bad Handshake»
Обычно 1043 ошибка возникает в тех случаях, когда mysql-клиент не поддерживает протокол аутентификации MySQL-сервера и соединение с сервером не может быть установлено.
Решением может быть синхронизация версий mysql-клиента и mysql-сервера или использование конструкции OLD_PASSWORD()
Сообщения 2
Чтобы отправить ответ, вы должны войти или зарегистрироваться
Форум PHP-MyAdmin.RU → MySQL & phpMyAdmin → Ошибка при соединении: «Error 1043: Bad Handshake»
Форум работает на PunBB , при поддержке Informer Technologies, Inc
Currently installed 7 official extensions . Copyright © 2003–2009 PunBB.
Источник
MySQL «bad handshake» after entering password
I’m having problem to connect to the remote DB from the terminal as follow
afer entering password I’m getting that error:
and I can connect to the DB from a PC using MySQL Workbench.
Running MySQL Ver 14.14 Distrib 5.1.73 for CentOS6
1 Answer 1
There is old Bug Report about MySQL Workbench connecting to older databases.
Others have come across this
When you google the subject of «mysql bad handshake», you will see two basic issues:
- Older Versions of MySQL
- Older Versions of ODBC/JDBC Drivers
The second post I referred to actually recommends «dummying down» and using an older product (MySQL Administrator for you Old School DBAs like myself).
Main thing to do is to make sure your drivers match the version of Workbench you are using. BTW Don’t feel bad about using MySQL 5.1. There are still a lot of die-hards out there that are using (I hope you sitting down), MySQL 3.23.58.
WHAT TO DO
Use Older Versions of MySQL Workbench, Navicat, SquirrelSQL.
Hey, that worked in the second post (Click Here for Those Tools)
Please remember that MySQL 5.1 made allowances for MySQL 4.1 password authentication. Newer ODBC/JDBC drivers may not understand MySQL 5.1’s way of authenticating and other network-related things, colloquially called «BAD HANDSHAKE».
Источник
Ошибка при соединении: «Error 1043: Bad Handshake»
Форум PHP-MyAdmin.RU → MySQL & phpMyAdmin → Ошибка при соединении: «Error 1043: Bad Handshake»
Чтобы отправить ответ, вы должны войти или зарегистрироваться
Сообщения 2
1 Тема от shaman 2007-01-30 14:12:37
- shaman
- Новичок
- Неактивен
- Зарегистрирован: 2007-01-30
- Сообщений: 1
Тема: Ошибка при соединении: «Error 1043: Bad Handshake»
При подключении к mysql выдается ошибка:
#1043 — Bad handshake
PHP 5.2.0, MySQL 5.0.27
2 Ответ от Lokki 2007-01-30 22:44:31
- Lokki
- Админ
- Неактивен
- Откуда: Москва
- Зарегистрирован: 2006-01-25
- Сообщений: 910
Re: Ошибка при соединении: «Error 1043: Bad Handshake»
Обычно 1043 ошибка возникает в тех случаях, когда mysql-клиент не поддерживает протокол аутентификации MySQL-сервера и соединение с сервером не может быть установлено.
Решением может быть синхронизация версий mysql-клиента и mysql-сервера или использование конструкции OLD_PASSWORD()
Сообщения 2
Чтобы отправить ответ, вы должны войти или зарегистрироваться
Форум PHP-MyAdmin.RU → MySQL & phpMyAdmin → Ошибка при соединении: «Error 1043: Bad Handshake»
Форум работает на PunBB , при поддержке Informer Technologies, Inc
Currently installed 7 official extensions . Copyright © 2003–2009 PunBB.
Источник
Answer by Lauryn Wise
make sure you’ve installed mysql-connector and not mysql-connector-python, to make this sure just run the following commands: pip3 uninstall mysql-connector-python pip3 install mysql-connector,
2
This was my problem, I was using pyCharm and it installed mysql-connector-python so I had to follow your recommendation to uninstall it and install the right one in my venv environment.
– fanbondi
Mar 1 at 9:18
,I am trying to connect to a mysql database (hosted on media temple) with my python script (ran locally) but I am receiving an error when I run it. ,Connect and share knowledge within a single location that is structured and easy to search.
The error is:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 179, in _open_connection
self._cmysql.connect(**cnx_kwargs)
_mysql_connector.MySQLInterfaceError: Bad handshake
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/Charlie/Documents/python/myscript/mysql_insert.py", line 8, in <module>
port="3306"
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mysql/connector/__init__.py", line 172, in connect
return CMySQLConnection(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 78, in __init__
self.connect(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mysql/connector/abstracts.py", line 735, in connect
self._open_connection()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 182, in _open_connection
sqlstate=exc.sqlstate)
mysql.connector.errors.OperationalError: 1043 (08S01): Bad handshake
Here is the code from the script
import mysql.connector
mydb = mysql.connector.connect(
host="external-db.s157688.gridserver.com",
user="myusername",
passwd="mypassword",
database="mydatabase",
port="3306"
)
mycursor = mydb.cursor()
sql = "INSERT INTO test (post_id, title) VALUES (%s, %s)"
val = [
('Peter', 'Lowstreet 4'),
('Amy', 'Apple st 652'),
('Hannah', 'Mountain 21'),
('Michael', 'Valley 345'),
('Sandy', 'Ocean blvd 2'),
('Betty', 'Green Grass 1'),
('Richard', 'Sky st 331'),
('Susan', 'One way 98'),
('Vicky', 'Yellow Garden 2'),
('Ben', 'Park Lane 38'),
('William', 'Central st 954'),
('Chuck', 'Main Road 989'),
('Viola', 'Sideway 1633')
]
mycursor.executemany(sql, val)
mydb.commit()
print(mycursor.rowcount, "was inserted.")
Answer by Clayton Rice
After updating mysql-connector-python to 8.0.11 (released April 19, 2018), I received an «OperationalError: 1043 (08S01): Bad handshake» error when querying a MySQL database. I found that I needed to set ‘use_pure: True’ in the connection string.,The C extension was added in version 2.1.1 and is enabled by default as of 8.0.11. The use_pure option determines whether the Python or C version of this connector is enabled and used.1,Since I don’t have the C extension installed on my server, I reverted back to the Python implementation. Though it is good to know that the C extension can improve performance for large queries—something to tuck away for future use.
For example2:
import mysql.connector
config = {
'user': 'scott',
'password': 'password',
'host': '127.0.0.1',
'database': 'employees',
'use_pure': True,
}
cnx = mysql.connector.connect(**config)
Answer by Conner Choi
afer entering password I’m getting that error:,There is old Bug Report about MySQL Workbench connecting to older databases.,When you google the subject of «mysql bad handshake», you will see two basic issues:,
Help Center
Detailed answers to any questions you might have
I’m having problem to connect to the remote DB from the terminal as follow
mysql -u db_user -p -h 10.100.1.100
Enter password:
afer entering password I’m getting that error:
ERROR 1043 (08S01): Bad handshake
Answer by Axl Freeman
Trying to connect to the database and getting a really weird error. Tried doing this without aiomysql but rather directly with PyMySQL and the connection worked fine. Would greatly appreciate some help.,
The text was updated successfully, but these errors were encountered:
,
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
,
Sorry, something went wrong.
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/aiomysql/connection.py", line 447, in _connect
yield from self._request_authentication()
File "/usr/local/lib/python3.5/dist-packages/aiomysql/connection.py", line 615, in _request_authentication
auth_packet = yield from self._read_packet()
File "/usr/local/lib/python3.5/dist-packages/aiomysql/connection.py", line 500, in _read_packet
packet.check_error()
File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py", line 393, in check_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.5/dist-packages/pymysql/err.py", line 120, in raise_mysql_exception
_check_mysql_exception(errinfo)
File "/usr/local/lib/python3.5/dist-packages/pymysql/err.py", line 115, in _check_mysql_exception
raise InternalError(errno, errorvalue)
pymysql.err.InternalError: (1043, 'Bad handshake')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.5/code.py", line 91, in runcode
exec(code, self.locals)
File "<input>", line 22, in <module>
File "/usr/lib/python3.5/asyncio/base_events.py", line 373, in run_until_complete
return future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 240, in _step
result = coro.send(None)
File "<input>", line 11, in test_example
File "/usr/local/lib/python3.5/dist-packages/aiomysql/utils.py", line 57, in __await__
resp = yield from self._coro
File "/usr/local/lib/python3.5/dist-packages/aiomysql/pool.py", line 28, in _create_pool
yield from pool._fill_free_pool(False)
File "/usr/local/lib/python3.5/dist-packages/aiomysql/pool.py", line 163, in _fill_free_pool
**self._conn_kwargs)
File "/usr/local/lib/python3.5/dist-packages/aiomysql/utils.py", line 52, in __iter__
resp = yield from self._coro
File "/usr/local/lib/python3.5/dist-packages/aiomysql/connection.py", line 76, in _connect
yield from conn._connect()
File "/usr/local/lib/python3.5/dist-packages/aiomysql/connection.py", line 467, in _connect
self._host) from e
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'XXX.XXX.XXX.XXX'")
Answer by Rosalia Macdonald
Content reproduced on this site is the property of the
respective copyright holders.It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
The file you have requested (bug.php?id=91828
)
does not exist.
bug.php?id=91828