Jump to content

mysql and python


ameliabob
 Share

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...