目录
1、centos6.5安装mysql,存储中文数据库里面乱码都是????
2、修改用户密码
?3、service mysql stop/start出现 Mysql server PID file cloud net be found
1、centos6.5安装mysql,存储中文数据库里面乱码都是????
?数据库版本:
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.6.22 |
+-----------+
1 row in set (0.00 sec)
?查看数据库字符集:
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
修改mysql字符集:修改my.cnf配置文件
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#skip-grant-tables
character-set-server = utf8
#default-character-set = utf8
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld_safe]
#default-character-set = utf8
character-set-server = utf8
[client]
#default-character-set = utf8
character-set-server = utf8
[mysql.server]
#default-character-set = utf8
character-set-server = utf8
[mysql]
#default-character-set = utf8
character-set-server = utf8
配置default-character-set会出现PID not found。Mysql5.6需要配置character-set-server。5.1可以用原来的。
重启:
# 第一种
service mysql quit/stop
service mysql start
# 第二种
service mysql restart
2、修改用户密码
在my.cnf配置文件中配置3
skip-grant-tables
配置文件修改后,重启一下mysql然后执行mysql就不需要账户密码了,再进行重新设置账户密码
按照以下步骤即可,然后再把配置文件配置skip-grant-tables注释掉。
?3、service mysql stop/start出现 Mysql server PID file cloud net be found
?解决办法:可能有正在运行的mysql进程,需要杀死后在进行停止或者重新启动
// 查看进程中是否有mysql进行在运行
ps -eg | grep mysql
// 强制杀死进程
kill -9 进程号
|