1。设置MySQL登陆密码:
code:[root@bogon /]# mysqladmin -u root password root
2。使用密码登陆:
code:[root@bogon /]# mysql -u root -p
3。设置字符集(linux的distributions:centOS6.0 mysql版本5.5.15)
首先,复制/usr/share/mysql/ my-medium.cnf到/etc下命名为my.cnf
code:[root@bogon mysql]# cp my-medium.cnf /etc/my.cnf
打开my.cnf文件,
在[mysqld]下添加character-set-server =utf8 (**有网友说在[client]下和[mysqld]都添加character-set-server =utf8,但是我这里是不好使的,都添加之后mysql服务不能启动了**)。
之后,启动mysql服务
code:[root@bogon mysql]# service mysql start
登录mysql
code:[root@bogon mysql]# mysql -u root -p
Enter password:
然后查看状态
code: mysql>status;
显示
-----------------------------------------------------------------------------------------------------
mysql Ver 14.14 Distrib 5.5.15, for Linux (i686) using readline 5.1
Connection id: 2
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.5.15-log MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 11 min 42 sec
Threads: 1 Questions: 8 Slow queries: 0 Opens: 15 Flush tables: 1 Open tables: 8 Queries per second avg: 0.011
----------------------------------------------------------------------------------------------------------
好,到此为止字符集设置完成。菜鸟走在linux路上,All hard work brings profit