Home >Database >Mysql Tutorial >Linux系统下安装配置MySQL时出现问题及解决过程

Linux系统下安装配置MySQL时出现问题及解决过程

WBOY
WBOYOriginal
2016-06-07 16:51:35998browse

在配置Linux下MySQL时候主要经历一下步骤:1、下载rpm,并且安装。问题:在安装完毕server后,出现输入mysql命令出错,并且在修改

在配置Linux下MySQL时候主要经历一下步骤:

1、下载rpm,并且安装。问题:在安装完毕server后,出现输入mysql命令出错,,并且在修改密码时候/usr/bin/下没有mysqladmin。解决:没有安装客户端造成。

2、修改密码:mysqladmin -uroot password123456;密码为123456。注意格式。执行成功

3、修改字符集,找了/etc/下,没有找到my.cnf。解决需要拷贝一个/usr/share/下my-huge.cnf ,my-innodb-heavy-4G.cnf ,my-large.cnf ,my-medium.cnf ,my-small.cnf这几个文件,选一个适合你的(针对你服务器的用途),把它copy到/etc下。我选的是my-medium.cnf。

# cp ./my-medium.cnf /etc/my.cnf

给两部分地方添加
[mysql]
default-character-set=utf8
[mysqlId]
default-character-set=utf8

4、重启mysql
/usr/bin/mysqladmin -uroot -p***** shutdown //关闭服务
/etc/init.d/mysql start //启动服务

查看当前编码格式:
mysql> show variables like 'character_set_%';

+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

OK。基本上配置成功。

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn