1 | |
---|
2 | |
---|
3 | Simple instructions to setup a MySQL database on 64-bit Ubuntu. |
---|
4 | |
---|
5 | Prepared by Prof. Chen Li for UCI course 'Principles of Data Management.' |
---|
6 | |
---|
7 | shell> sudo apt-get update |
---|
8 | shell> sudo apt-get install mysql-server |
---|
9 | shell> sudo apt-get install mysql-client |
---|
10 | |
---|
11 | shell> mysql -u root -p |
---|
12 | |
---|
13 | mysql> CREATE USER 'mytestuser'@'localhost' IDENTIFIED BY 'mypassword'; |
---|
14 | mysql> GRANT ALL PRIVILEGES ON * . * TO 'mytestuser'@'localhost'; |
---|
15 | |
---|
16 | mysql> create database moviedb; |
---|
17 | mysql> use moviedb; |
---|
18 | |
---|
19 | mysql> 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 | |
---|
27 | mysql> 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 | |
---|
29 | mysql> 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 | |
---|
31 | mysql> select * from stars; |
---|
32 | mysql> exit |
---|
33 | |
---|
34 | shell> mysql -u mytestuser -p |
---|
35 | mysql> use moviedb; |
---|
36 | mysql> select * from stars; |
---|
37 | |
---|
38 | |
---|
39 | |
---|