Quantcast
Channel: MySQL Forums - Connector/Python
Viewing all articles
Browse latest Browse all 384

create database and user via a python script ran as sudo (no replies)

$
0
0
Hello
I am writing a python script which I runas sudo. The goal of the python script is to create a user and a database for this user.
I get the following message.
>>> mydb = mysql.connector.connect( host = "localhost", user = user, password = "mypassword")
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/mysql/connector/connection_cext.py", line 236, in _open_connection
self._cmysql.connect(**cnx_kwargs)
_mysql_connector.MySQLInterfaceError: Access denied for user 'root'@'localhost'

This happens just after the installation of the package mysql server. Thus I have not yet granted any privileges to root.

Is this the cause of the problem? should I write a shell script to install all my sql packages and grant the privileges??
I thank you for your help.

Viewing all articles
Browse latest Browse all 384

Trending Articles