I did the steps below with Python 3.5.1 and it works:

  • Download driver from here
  • Driver installation in cmd, in this folder Python\Python35\PyMySQL-0.7.4\pymysql

    python setup.py build
    python setup.py install
  • Copy folder Python\Python35\PyMySQL-0.7.4\pymysql to Python\Python35\pymysql

  • Sample code in python IDE

    import pymysql
    import pymysql.cursor
    conn= pymysql.connect(host='localhost',user='user',password='user',db='testdb',charset='utf8mb4',cursorclass=pymysql.cursors.DictCursor)
    a=conn.cursor()
    sql='CREATE TABLE `users` (`id` int(11) NOT NULL AUTO_INCREMENT,`email` varchar(255) NOT NULL,`password` varchar(255) NOT NULL,PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'
    a.execute(sql)
  • Enjoy It!

相关文章:

  • 2022-12-23
  • 2021-04-30
  • 2021-12-17
  • 2021-09-08
  • 2021-11-16
  • 2021-12-26
  • 2021-08-03
  • 2021-11-28
猜你喜欢
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2021-12-02
  • 2021-11-02
相关资源
相似解决方案