Python complete tutorial
  • Python Complete Tutorial
  • About this book
  • What you need to prepare
  • 1️⃣Try python for the first time
    • Install python
    • Hello world!
    • Hello world in a nutshell
    • The first simple python project
    • most useful libraries
    • Recommended websites
  • 2️⃣Data structure and basic operations
    • Python data structure
    • Data structure without hash table
    • Data structure with hash table
    • Variability and address
    • basic python programming
    • basic python programming 2
    • basic python programming 3
    • some additions
    • Fibonacci sequence
    • Judging prime numbers
    • txt/csv file operation
  • 🐍Practice program
    • 🚩fancy print
    • 🚩Remove duplicate elements
    • 🚩Palindrome detection
  • 😎leetcode
    • what is leetcode
  • 3️⃣Data mining and machine learning
    • What is data mining
    • iris data set
    • Mean median mode
    • Harmonic mean
    • Histogram
    • Correlation algorithm
    • Gaussian distribution data set
    • projection
    • PCA
    • MDS
    • Bayesian and Frequentist
    • Data normalization
    • binary SVM
    • One Hot Encoding
    • Multi-class SVM
    • Accuracy and error rate
    • Confusion matrix & Accuracy, Precision, Recall
    • F1 score
    • ROC and AUC
  • 4️⃣big data and data visualization
    • line chart
    • Parallel coordinates
    • Histogram chart
  • 5️⃣Mathematical algorithm and digital signal processing
    • Mathematical constants and basic operations
    • Normal distribution
    • Permutation and combination
    • Bernoulli distribution
    • Chaotic system
  • 6️⃣Classes and design patterns
    • Classes and design patterns
  • 7️⃣Operate the database with python
    • MySQL
      • Install MySQL
      • First try MySQL
      • MySQL Architecture
      • database operations
      • database
  • 8️⃣Cryptography
    • beginning of Cryptography
  • 9️⃣deep learning
    • What is Deep Learning
    • basic
  • 💔algorithm
    • Algorithms and Data Structures
Powered by GitBook
On this page
  • query database
  • create database
  • Modify the database
  • delete database
  • Statistics
  1. Operate the database with python
  2. MySQL

database

query database

show databases;

This command can query all databases in MySQL.

+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| naive              |
| performance_schema |
| sys                |
| world              |
+--------------------+
6 rows in set (0.00 sec)

Above we can see all the databases we already have. The world database is the database that comes with MySQL for our practice, naive is the database I created, and the other four databases are MySQL system databases. We should not delete them or modify them.

create database

create database naive;

I used the above command to create a database. If the database does not exist, the database will be created. If the database exists, ERROR 1007 (HY000): Can't create database 'naive'; database exists will be returned.

Modify the database

If we want to modify a database, then we should enter this database:

use naive;

After you have selected the database, you can modify the contents of this database.

delete database

drop database sakila;

The above command will delete the sakila database, please be very careful, because the authority of this command is very high, if you accidentally delete the database without backup, it will be very difficult to restore, so you should not generally operate the database using root privileges (in a company you don't normally have root privileges)

sakila is a database that comes with MySQL. If you execute this command and delete the sakila database, don't worry, because you can easily restore this database:

If you use the windows platform, you just need to double-click the sql file, it will automatically start the MySQL GUI interface, you just need to run the query code, and then the database will be installed in your MySQL.

Statistics

Start time of this page: February 10, 2022

Completion time of this page: February 10, 2022

Previousdatabase operationsNextbeginning of Cryptography

Last updated 3 years ago

7️⃣
Page cover image
MySQL :: Setting Up the world Database :: 2 Installation
install world database
Logo
MySQL :: Sakila Sample Database :: 4 Installation
install sakila database
Logo