Mysql
MySQL
Table of Contents
Install
| sudo apt install mysql-server
|
Run
| sudo mysql -u root -p #default password for root is "password"
|
if you get :
| ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
|
then check
Default password for root is: password
Help
chage root password
| sudo mysqladmin password <new password>
|
Database
Install test_db
- sakila
- employees
- source: https://github.com/toransahu/test_db
Install Sakila
db prepared by mysql
| wget http://downloads.mysql.com/docs/sakila-db.tar.gz
tar -xzf sakila-db.tar.gz
cd sakila-db
mysql -u root -p < sakila-schema.sql
mysql -u root -p < sakila-data.sql
|
GRANTS
| GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
|
To see databases
To create a database
| mysql> create database <db_name>;
Query OK, 1 row affected (0.00 sec)
|
To use a database
Tables
To see tables
Subprograms
Aggregation Functions
Analytical Functions
- MySQL doesn't have Analytical Functions
- while it is in
- MSSQL
- Oracle
- PostgreSQL
- MariaDB
Window Function
over()