ameliabob Posted July 8, 2018 Share Posted July 8, 2018 I am trying to install and start mysql under python. I am not sure that this is the correct forum or not. If not point me to the correct one. I am trying to run this query in the python environment but I am not sure what to import ahead of this code import mysql CREATE TABLE closed( rowId INT NOT NULL auto_INCREMENT type ENUM("O","S") symbol VARCHAR(6) sellDate DATE qty INT source VARCHAR(50) daysHeld INT pl INT ) ENGINE=InnoDB I keep getting the error "Invalid syntax" point to the word "TABLE" Thanx Link to comment Share on other sites More sharing options...
dsonesuk Posted July 8, 2018 Share Posted July 8, 2018 https://www.w3schools.com/python/python_mysql_create_db.asp Link to comment Share on other sites More sharing options...
ameliabob Posted July 9, 2018 Author Share Posted July 9, 2018 The tutorial look simple and straight forward but when I run >>> import mysql.connector >>> mydb = mysql.connector.connect( host="localhost", user="root" ) I get this error Traceback (most recent call last): File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\mysql\connector\connection_cext.py", line 176, in _open_connection self._cmysql.connect(**cnx_kwargs) _mysql_connector.MySQLInterfaceError: Access denied for user 'root'@'localhost' (using password: NO) I never get to the cursor creation Link to comment Share on other sites More sharing options...
justsomeguy Posted July 9, 2018 Share Posted July 9, 2018 MySQLInterfaceError: Access denied for user 'root'@'localhost' (using password: NO) That should be pretty self-explanatory. MySQL is not letting the root user connect without a password. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now