全部博文(930)
分类: Mysql/postgreSQL
2010-04-12 13:43:04
Installation
1.mysqladmin -u root password 'password' [-p]
修改MySQL 数据库密码,如果起先没有密码就不用后面的-p了,如果有密码就加上-p和mysql -u user -p 一样的用法。
The Sakila sample database is available from http://dev.mysql.com/doc/index-other.html. A downloadable archive is available in compressed tar file or Zip format. The archive contains three files: sakila-schema.sql, sakila-data.sql, and sakila.mwb.
The sakila-schema.sql file contains all the CREATE statements required to create the structure of the Sakila database including tables, views, stored procedures, and triggers.
The sakila-data.sql file contains the INSERT statements required to populate the structure created by the sakila-schema.sql file, along with definitions for triggers that must be created after the initial data load.
The sakila.mwb file is a MySQL Workbench data model that you can open within MySQL Workbench to examine the database structure. For more information, see MySQL Workbench.
To install the Sakila sample database, follow these steps:
Extract the installation archive to a temporary location such as C:\temp\ or /tmp/. When you unpack the archive, it creates a directory named sakila-db that contains the sakila-schema.sql and sakila-data.sql files.
下面是linux下的操作过程
Connect to the MySQL server using the mysql command-line client with the following command:
shell> mysql -u root -p
Enter your password when prompted. A non-root account can be used as long as the account has privileges to create new databases.
Execute the sakila-schema.sql script to create the database structure by using the following command:
mysql> SOURCE /root/mysql/sakila-db/sakila-schema.sql;
Replace /root/mysql/sakila-db with the path to the sakila-schema.sql file on your system.
Note
On Windows you should use slashes, rather than backslashes, when executing the SOURCE command.
Execute the sakila-data.sql script to populate the database structure with the following command:
mysql> SOURCE /root/mysql/sakila-db/sakila-data.sql;
Replace /root/mysql/sakila-db with the path to the sakila-data.sql file on your system.
Confirm that the sample database is installed correctly. Execute the following statements. You should see output similar to that shown here.
mysql> USE sakila;
Database changed
mysql> SHOW TABLES;
+----------------------------+
| Tables_in_sakila |
+----------------------------+
| actor |
| address |
| category |
| city |
| country |
| customer |
| customer_list |
| film |
| film_actor |
| film_category |
| film_list |
| film_text |
| inventory |
| language |
| nicer_but_slower_film_list |
| payment |
| rental |
| sales_by_film_category |
| sales_by_store |
| staff |
| staff_list |
| store |
+----------------------------+
22 rows in set (0.00 sec)