Create Database
Сообщение 2022-11-07 09:44:40
0
234
To create a database in MySQL, use the "CREATE DATABASE" statement:
Below is the example of Creating a MySQL Database in Python:
import mysql.connector mydb = mysql.connector.connect( host="localhost", user="yourusername", password="yourpassword" ) mycursor = mydb.cursor() mycursor.execute("CREATE DATABASE mydatabase")
If the above code was executed with no errors, It means your database has been successfully created.
Check if Database Exists
You can also check if a database exist before you create a database by listing all databases in your system by using the "SHOW DATABASES" statement. Below is the example:
import mysql.connector mydb = mysql.connector.connect( host="localhost", user="yourusername", password="yourpassword" ) mycursor = mydb.cursor() mycursor.execute("SHOW DATABASES") for x in mycursor: print(x)
Поиск
Категории
- Information Technology
- Office Equipment and Supplies
- Cars and Trucks
- Persons
- Books and Authors
- Tutorials
- Art
- Causes
- Crafts
- Dance
- Drinks
- Film
- Fitness
- Food
- Игры
- Gardening
- Health
- Главная
- Literature
- Music
- Networking
- Другое
- Party
- Religion
- Shopping
- Sports
- Theater
- Wellness
Больше
食品廃棄物の処理の世界市場規模:全体売上と需要分析予測2025~2031
食品廃棄物の処理世界総市場規模...
靴用射出成形機市場競争分析:主要企業、ランキング、投資動向2025
QYResearch株式会社(所在地:東京都中央区)は、最新の調査資料「靴用射出成形機―グローバル市場シェアとランキング、全体の売上と需要予測、2025~2031」を2025年5月30日より発行...
Graphic Design Services in Singapore
Professional Web Design, WordPress Maintenance & Graphic Design Services in Singapore |...
Zircon Sand’s Role in Nuclear and Aerospace Applications
Zircon sand, a naturally occurring mineral composed primarily of zirconium silicate (ZrSiO₄), is...
Electronic Support Market Expands with Enhanced Military Surveillance and Intelligence Capabilities
"Executive Summary Electronic Support Market :
Data Bridge Market Research analyses...
© 2025 Omaada - A global social and professionals networking platform
Russian
