PyMysql

参考

Github: https://github.com/PyMySQL/PyMySQL/tree/main

要求

  • Python -- one of the following:

  • CPython : 3.7 and newer

  • PyPy : Latest 3.x version

  • MySQL Server -- one of the following:

  • MySQL >= 5.7

  • MariaDB >= 10.2

安装

python3 -m pip install PyMySQL

例子

CREATE TABLE `users` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `email` varchar(255) COLLATE utf8_bin NOT NULL,
    `password` varchar(255) COLLATE utf8_bin NOT NULL,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
AUTO_INCREMENT=1 ;

使用

结果

Last updated