cs222p-2018-fall: setup-mysql.txt

File setup-mysql.txt, 1.2 KB (added by qiushi, 3 years ago)
Line 
1
2
3Simple instructions to setup a MySQL database on 64-bit Ubuntu.
4
5Prepared by Prof. Chen Li for UCI course 'Principles of Data Management.'
6
7shell> sudo apt-get update
8shell> sudo apt-get install mysql-server
9shell> sudo apt-get install mysql-client
10
11shell> mysql -u root -p
12
13mysql> CREATE USER 'mytestuser'@'localhost' IDENTIFIED BY 'mypassword';
14mysql> GRANT ALL PRIVILEGES ON * . * TO 'mytestuser'@'localhost';
15
16mysql> create database moviedb;
17mysql> use moviedb;
18
19mysql>  create table stars(
20             id integer primary key,
21             first_name varchar(50),
22             last_name varchar(50),
23             dob date,
24             photo_url varchar(200)
25             );
26                 
27mysql> INSERT INTO stars VALUES(755011, 'Arnold', 'Schwarzeneggar', '1947/07/30', 'http://www.imdb.com/gallery/granitz/2028/Events/2028/ArnoldSchw_Grani_1252920_400.jpg?path=pgallery&path_key=Schwarzenegger,%20Arnold');
28                 
29mysql> INSERT INTO stars VALUES(755017, 'Eddie', 'Murphy', '1961/04/03', 'http://www.imdb.com/gallery/granitz/2487/Events/2487/EddieMurph_Pimen_2724994_400.jpg?path=pgallery&path_key=Murphy,%20Eddie%20(I)');
30
31mysql> select * from stars;
32mysql> exit
33
34shell> mysql -u mytestuser -p
35mysql> use moviedb;
36mysql> select * from stars;
37
38
39