码迷,mamicode.com
首页 > 数据库 > 详细

Mysql数据库常用操作

时间:2014-06-25 10:41:48      阅读:451      评论:0      收藏:0      [点我收藏+]

标签:mysql   数据库   操作   

1.备份数据库

[root@bj-db-x86v-app01 ~]# mysqldump -h 192.168.0.8 -uroot  -p‘123456‘  user >user.sql

2.查看mysql数据库字符集设置

mysql> show variables like ‘character_set_%‘;
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | latin1                     |
| character_set_connection | latin1                     |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | latin1                     |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

3.更改数据库的字符集

mysql> alter database opensips default character set ‘utf8‘;

4.创建数据库时指定字符集

mysql> create databse opensips character set utf8 collate utf8_general_ci; 

5.在mysql的配置文件/etc/my.cnf中指定创建的数据库的默认字符集
[mysqld]

default-character-set=utf8

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[client]
default-character-set=utf8

本文出自 “云人生” 博客,请务必保留此出处http://ovcer.blog.51cto.com/1145188/1430465

Mysql数据库常用操作,布布扣,bubuko.com

Mysql数据库常用操作

标签:mysql   数据库   操作   

原文地址:http://ovcer.blog.51cto.com/1145188/1430465

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!