ITEXPERT Python

MySql/MariaDB basic command for beginners with Python

Let’s go for MySql DB, Step by Step

Step 1. Setup MySql Program
1.1 Install Mysql DB from Web (Download)
1.2 pip install pymysql (for python)

Step 2. Create/Assign Database, User, Permission
2.1 Login Mysql DB(command) : “mysql -u root -p”
2.2 Create Database: “create database sample1;”
<Sameple1 = database name>
2.3 Assign permission to DB : “grant all privileges on sample1.* to ‘user1’@’localhost‘ identified by ‘pass’;”
<User1 = username, pass = password for user1>
2.4 Apply to DB : “flush privileges;”

Step 3. Remove User/Role/Database
3.1 Remove DB : “drop database sample1;”
3.2 Remove User1 : “drop user ‘user1’@localhost;”
3.3 Remove User1 : “drop user user1;”

Step x. Others
x.1 All permission to All DB : “grant all privileges on *.* to user1@localhost identified by ‘pass’ with grant options;”
x.2 limited permission to DB : “grant select, insert, update on sample1.* to user1@localhost identified by ‘pass”
x.3 limited permission to DB : “grant all privileges on sample1.* to user1@localhost identified by ‘pass”
x.4 Show table structure : “show columns from tablename;”
x.5 Check privileges on DB : “show grants for sample1@’%’;”

 

continued…