Skip to content

Latest commit

 

History

History
54 lines (32 loc) · 1 KB

mysql.rst

File metadata and controls

54 lines (32 loc) · 1 KB

MySQL

$ sudo apt-get install mysql-server
$ mysql -u user -p
mysql> CREATE DATABASE databasename;
mysql> SHOW DATABASES;
mysql> CREATE USER 'user'@'localhost' IDENTIFIED BY 'some_password';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
    -> ON cons_cmo.*
    -> TO 'user'@'localhost';
mysql> \q
$ mysql -u user -p databasename < dump_file.sql
$ mysql -u user -p
mysql> USE databasename;

You can see at any time which database is currently selected using

mysql> SELECT DATABASE();
mysql> SHOW TABLES;
mysql> DESCRIBE table;
mysql> SELECT * FROM table;

Python

(venv)$ pip install mysql-connector==2.1.4

Referencias

MySQL Connector/Python Developer Guide

mysql-connector