-
Notifications
You must be signed in to change notification settings - Fork 0
/
MySQL
36 lines (22 loc) · 794 Bytes
/
MySQL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
1) mysql -u root -p
2) SHOW DATABASES;
3) CREATE DATABASE database_name ;
4) use database_name
4.1) source /var/www/database.sql (import)
5) SHOW TABLES;
6) CREATE TABLE MyGuests (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
email VARCHAR(50),
reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
7) desc MyGuests;
8) sudo apt install mysql-server
9) sudo service mysql status
10) mysql -u root
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
sudo apt-get remove --purge mysql*
https://www.digitalocean.com/community/tutorials/how-to-move-a-mysql-data-directory-to-a-new-location-on-ubuntu-20-04