• Saturday , 15 December 2018

MySQL Database with Python Tutorial Part 4 – Inserting Variables as Data

Code Canyon



Python + MySQL in playlist: http://www.youtube.com/watch?v=lhU2OZCKXhQ&feature=share&list=PLQVvvaa0QuDfhTF3Zfyzc_yD-Mq9iTp4G&index=26 This …

Original source

3d Ocean

Related Posts

15 Comments

  1. Raghu Vamsha Kokkula
    October 3, 2018 at 04:15

    If anyone is following in 2018, Pythonanywhere has changed the host from "mysql.server" to "username.mysql.pythonanywhere-services.com"
    if anyone is getting this error -> _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host 'mysql.server' (0)")
    You have to change the host name.

  2. jt4dfc5zw39
    October 3, 2018 at 04:15

    Connecting to 'mysql.server' didn't work for me. But 'username.mysql.pythonanywhere-services.com' worked. So in sentex's case that would be 'beginneraccount.mysql.pythonanywhere-services.com'

  3. jt4dfc5zw39
    October 3, 2018 at 04:15

    Thank you so much for this tutorial! I was stuck and beginning to lose hope.

  4. iliqanew iliqanew
    October 3, 2018 at 04:15

    can i use MySQLdb in python3.6. Even pip can´t find this library

  5. Nolan Perrini
    October 3, 2018 at 04:15

    where tf is the insert????

  6. nastyguyrin
    October 3, 2018 at 04:15

    Where's the INSERT?

  7. Iqbal Widodo
    October 3, 2018 at 04:15

    can i ask some question please?
    1. i have some python program on my pc and mysql database at pythonanywhere, is there any way to access the data from my table via local pc script?
    2. how to get my data via local python script? lets just say i need to execute (select * from my_database) . how to execute it?
    3. is there any way to use json in pythonanywhere for mysql??

    thank you very much

  8. GateCrashers
    October 3, 2018 at 04:15

    how to install the mysqldb module
    I am NOT using python anywhere , I am using Anaconda(Spyder)

  9. Aayush Aishwani
    October 3, 2018 at 04:15

    I am newbie in python and I am facing difficulty in storing
    various fields of html page into database.
    E.g, I have a html page which contains 5 fields and one submit button .
    On submitting the form, I want all values from html form should be
    stored in table of the given database.
    Please help me in this.

  10. Minjun Kim
    October 3, 2018 at 04:15

    Hello Sentdex,

    Sorry for giving you many questions here and there, but I have to figure this out.

    So I have a linux server I rent from Digital Ocean and I have set up everything followed by your tutorials. Now, in my windows 10 laptop computer, I want to connect to the linux server to access the mysql databases in that sever. For that, I first, in the linux server, granted my local windows computer ALL permissions with the ip address that I am connected to right now. And in python, I wrote
    conn = MySQLdb.connect("xxx.xxx.xxx.x", "new_username", "new_password", "database name" )
    But this does not work. I tried "new_username$database name" also. Not working. It give me this error message:
    OperationalError: (2003, "Can't connect to MySQL server on 'xxx.xxx.xxx.x' (10061)")

    What went wrong?

  11. rahul bhambri
    October 3, 2018 at 04:15

    free accounts can have 2 consoles, just fyi.

  12. Juan Carlos Suarez
    October 3, 2018 at 04:15

    Was not able to do it your way but after trial an error I managed:

    #!/usr/bin/env python2.7 (Seemst new default to 3 is making the problem as well)
    import MySQLdb

    db = MySQLdb.connect(host = 'xx', user = 'xx, passwd = 'xx', db = 'xx$default')

    c = db.cursor()

    c.execute("SELECT * FROM taula")

    rows = c.fetchall()

    for e in rows:
    print e

  13. Alexander Mangaard
    October 3, 2018 at 04:15

    The ImportError: No module named MySQLdb is easily solved.

    Open a bash console and type in:
    pip3.4 install –user https://github.com/davispuh/MySQL-for-Python-3/archive/1.0.tar.gz

    pip3.3 for python 3.3 🙂

    pythonanywhere.com/wiki/UsingMySQL for more guidelines.

  14. Four Noble Truths
    October 3, 2018 at 04:15

    +ChangeTip pez

  15. Ty George
    October 3, 2018 at 04:15

    If anyone is trying to do this on an RPI and is having troubles, and is having the "ImportError: No module named MySQLdb" …. i had troubles too until i removed python-mysqldb then reinstalled with aptitude
    "sudo aptitude install python-mysqldb"

    Thanks for your video's… they helped me alot

Leave A Comment

You must be logged in to post a comment.