---------------------------------------------------------------------------
OperationalError Traceback (most recent call last)
<ipython-input-41-2398e0e9f729> in <module>
----> 1 conn, curs, engine = get_connection('DB')
<ipython-input-40-0df5a5916330> in get_connection(db_name)
18 user=user,
19 password=password,
---> 20 database=db_name)
21 curs = conn.cursor()
22 engine = create_engine(f"mysql+pymysql://{user}:{password}@{host}:{str(port)}/" \
~\Anaconda3\lib\site-packages\pymysql\__init__.py in Connect(*args, **kwargs)
92 """
93 from .connections import Connection
---> 94 return Connection(*args, **kwargs)
95
96 from . import connections as _orig_conn
~\Anaconda3\lib\site-packages\pymysql\connections.py in __init__(self, host, user, password, database, port, unix_socket, charset, sql_mode, read_default_file, conv, use_unicode, client_flag, cursorclass, init_command, connect_timeout, ssl, read_default_group, compress, named_pipe, autocommit, db, passwd, local_infile, max_allowed_packet, defer_connect, auth_plugin_map, read_timeout, write_timeout, bind_address, binary_prefix, program_name, server_public_key)
323 self._sock = None
324 else:
--> 325 self.connect()
326
327 def _create_ssl_ctx(self, sslp):
~\Anaconda3\lib\site-packages\pymysql\connections.py in connect(self, sock)
597
598 self._get_server_information()
--> 599 self._request_authentication()
600
601 if self.sql_mode is not None:
~\Anaconda3\lib\site-packages\pymysql\connections.py in _request_authentication(self)
859
860 self.write_packet(data)
--> 861 auth_packet = self._read_packet()
862
863 # if authentication method isn't accepted the first byte
~\Anaconda3\lib\site-packages\pymysql\connections.py in _read_packet(self, packet_type)
682
683 packet = packet_type(buff, self.encoding)
--> 684 packet.check_error()
685 return packet
686
~\Anaconda3\lib\site-packages\pymysql\protocol.py in check_error(self)
218 errno = self.read_uint16()
219 if DEBUG: print("errno =", errno)
--> 220 err.raise_mysql_exception(self._data)
221
222 def dump(self):
~\Anaconda3\lib\site-packages\pymysql\err.py in raise_mysql_exception(data)
107 errval = data[3:].decode('utf-8', 'replace')
108 errorclass = error_map.get(errno, InternalError)
--> 109 raise errorclass(errno, errval)
OperationalError: (1045, "Access denied for user 'USER'@'HOST' (using password: YES)")
댓글