【关于安装mysql5.6的一些问题总结】
1:安装msyql5.6介质(mysql-5.6.24-winx64.msi)以后没有myslq服务:
解决:
管理员身份cmd进入bin目录:
mysqld.exe -install
Service successfully installed
启动服务即可
2:修改mysql root用户没有密码问题:
解决:
mysql -u root -p 直接回车,无需输入密码就可以进入数据库了。 此时在命令行下执行 use mysql (切换到系统数据库)
执行:update user set password=PASSWORD("root") where user='root';重启mysql服务即可
3:修改mysql字符编码:
解决:
将mysql的安装目录(C:\Program Files\MySQL\MySQL Server 5.6)的my-default.ini复制一份,重命名为my.ini(因为mysql5.6没有my.ini文件)
添加:
[mysql]
port=3306
default-character-set=utf8
[mysqld]
character-set-server=utf8
重启服务即可:
mysql> show variables like '%character%';
+--------------------------+---------------------------------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | C:\Program Files\MySQL\MySQL Server 5.6\share\charsets\ |
+--------------------------+---------------------------------------------------------+
附:完整配置文件内容:
[client]
#password =1234
# pipe
# socket=mysql
port=3306
default-character-set=utf8
[mysql]
port=3306
default-character-set=utf8
[mysqld]
port=3306
basedir="C:\Program Files\MySQL\MySQL Server 5.6"
datadir="C:\Program Files\MySQL\MySQL Server 5.6\data"
character-set-server=utf8
default-storage-engine=INNODB
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
# Enable Windows Authentication
# plugin-load=authentication_windows.dll
# General and Slow logging.
log-output=NONE
general-log=0
general_log_file="WANGZHANGJIE.log"
slow-query-log=0
slow_query_log_file="WANGZHANGJIE-slow.log"
long_query_time=10
# Binary Logging.
# log-bin
# Error Logging.
log-error="WANGZHANGJIE.err"
max_connections=100
query_cache_size=0
table_open_cache=2000
tmp_table_size=20M
thread_cache_size=9
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=39M
key_buffer_size=8M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=256K
#*** INNODB Specific options ***
# innodb_data_home_dir=0.0
innodb_additional_mem_pool_size=2M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=97M
innodb_log_file_size=48M
innodb_thread_concurrency=9
# The increment size (in MB) for extending the size of an auto-extend InnoDB system tablespace file when it becomes full.
innodb_autoextend_increment=64M
innodb_buffer_pool_instances=8
# Determines the number of threads that can enter InnoDB concurrently.
innodb_concurrency_tickets=5000
# Specifies how long in milliseconds (ms) a block inserted into the old sublist must stay there after its first access before
# it can be moved to the new sublist.
innodb_old_blocks_time=1000
# It specifies the maximum number of .ibd files that MySQL can keep open at one time. The minimum value is 10.
innodb_open_files=300
# When this variable is enabled, InnoDB updates statistics during metadata statements.
innodb_stats_on_metadata=0
# When innodb_file_per_table is enabled (the default in 5.6.6 and higher), InnoDB stores the data and indexes for each newly created table
# in a separate .ibd file, rather than in the system tablespace.
innodb_file_per_table=1
# Use the following list of values: 0 for crc32, 1 for strict_crc32, 2 for innodb, 3 for strict_innodb, 4 for none, 5 for strict_none.
innodb_checksum_algorithm=0
back_log=70
flush_time=0
join_buffer_size=256K
max_allowed_packet=4M
max_connect_errors=100
open_files_limit=4110
query_cache_type=0
sort_buffer_size=256K
table_definition_cache=1400
binlog_row_event_max_size=8K
sync_master_info=10000
sync_relay_log=10000
sync_relay_log_info=10000