2013年8月5日星期一

ubuntu install and configure mysql

 

1. install mysql

 
  
1 sudo apt-get install mysql-server
 
 

2. Configure mysql

 

mysql is installed by default not set a password , use the command to set your password.

 
  
mysql -u root
 
 

character set

 

1) view the current coding : show variables like 'character%';

 

2) modify the my.cnf, in the [client] to add default-character-set = utf8

 

3) in the [server] to add default-character-set = utf8, init_connect = 'SET NAMES utf8;'

 

4) restart mysql.

 

Note: Only modify / etc under the my.cnf settings to make the client 's onset, the installation directory can only be set to enable the server 's settings are valid.

 

binary installation modifications / etc / mysql / my.cnf can

 

support mysql client : Mysql-Front, Navicat, PhpMyAdmin, Linux Shell

 

myself using Navicat

 

3. backup mysql

 

back up a single database : mysqldump-uroot-p-B dbname> dbname.sql

 

backup all databases : mysqldump-uroot-p - all-databases> all.sql

 

backup table : mysqldump-uroot-p-B dbname - table tablename> tablename.sql

 

restore the database : mysql-uroot-p

 

recovery table : mysql-uroot-p dbname

 

没有评论:

发表评论