我们以安装5.7.13 为例
1.安装顺序
2.生成随机密码在/var/log/mysqld.log
3.查看密码
4. 启动mysql ,并登录,修改密码
4.权限
7. 测试字符乱码
utf8
如果是默认会报错
8.如何修改字符集编码
启动失败
日志
2017-03-16T10:34:11.658379Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
2017-03-16T10:34:59.145328Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2017-03-16T10:34:59.347856Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-03-16T10:34:59.349428Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.13) starting as process 14918 ...
2017-03-16T10:34:59.354925Z 0 [Note] InnoDB: PUNCH HOLE support available
2017-03-16T10:34:59.354961Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-16T10:34:59.354971Z 0 [Note] InnoDB: Uses event mutexes
2017-03-16T10:34:59.354978Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2017-03-16T10:34:59.354985Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-03-16T10:34:59.354991Z 0 [Note] InnoDB: Using Linux native AIO
2017-03-16T10:34:59.355249Z 0 [Note] InnoDB: Number of pools: 1
2017-03-16T10:34:59.355370Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-03-16T10:34:59.357336Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-03-16T10:34:59.365656Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-03-16T10:34:59.367640Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2017-03-16T10:34:59.379574Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-16T10:34:59.440318Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2017-03-16T10:34:59.440589Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2017-03-16T10:34:59.729333Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2017-03-16T10:34:59.731144Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2017-03-16T10:34:59.731180Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2017-03-16T10:34:59.732462Z 0 [Note] InnoDB: 5.7.13 started; log sequence number 2539685
2017-03-16T10:34:59.733559Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2017-03-16T10:34:59.733979Z 0 [Note] Plugin 'FEDERATED' is disabled.
2017-03-16T10:34:59.734852Z 0 [ERROR] unknown variable 'default-character-set=utf8'
2017-03-16T10:34:59.734885Z 0 [ERROR] Aborting
注意mysqld 是三个一起加上
vi /etc/my.cnf
[mysqld]
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
[client]
default-character-set=utf8
启动成功