1. Sudo apt-get install mysql-server, input Administrator password, ' 123 '
2. Enter MySQL promot command line, ' mysql-u root-p ', input password
3. Create DATABASE "CREATE database xoops;"
4. Consent to root remote login: From all hosts: Grant all privileges on * * to [email protected] "%" identified by "Passw0rd" with GRANT option;
5. Build the database and create the user:
1) Build database: Create DATABASE test1;
2) Build user, Empower: Grant all privileges on test1.* to [email protected] "%" identified by "Passw0rd" with GRANT option;
3) Delete databases: Drop database test1;
6. Delete permissions:
1) Revoke all privileges in test1.* from [email protected] "%";
2) use MySQL;
3) Delete from user where user= "root" and host= "%";
4) flush privileges;
8. Show all databases: show databases; Show all tables in the library: show tables;
9. telnet mysql:mysql-h ip-u user-p
10. Backup and Recovery
Backing up a single database: mysqldump-uroot-p-B dbname > Dbname.sql
Back up all databases: Mysqldump-uroot-p--all-databases > All.sql
Backup table: mysqldump-uroot-p-B dbname--table tablename > Tablename.sql
Recovery database: Mysql-uroot-p < Name.sql
Recovery table: Mysql-uroot-p dbname < Name.sql (database must be specified)
Sample: Create a database table Mysql>create IF not EXISTS my_db default charset UTF8 COLLATE utf8_general_ci;
#注意后面这句话 "COLLATE utf8_general_ci", which roughly means sorting according to UTF8 format.
#那么在这个数据库下创建的全部数据表的默认字符集都会是utf8了
Mysql>create table my_table (name varchar () NOT NULL default ') Type=myisam default CharSet UTF8; #这句话就是创建一个表了, set the default character set to UTF8
C + + Sample code:
1. Boost Libary is required. "Sudo apt-get install Libboost-date-time-dev"
2. http://dev.mysql.com/tech-resources/articles/building-mysql-connector-cpp.html
3. CREATE DATABASE FaceDB4. CREATE TABLE facetable (id int,facename text,username TEXT)
MYSQL Installation and 0 basics using specific explanations