Jump to content
ameliabob

mysql and python

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

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...