文章目录
1.下载yum.repo2.安装repo3.安装4.启动5.登录6.修改密码7.开启远程连接连接数据库8.修改编码
1.下载yum.repo
centos 6.x http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm centos7.x http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
[root@yue ~
]
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.4.1708
(Core
)
Release: 7.4.1708
Codename: Core
[root@yue ~
]
2.安装repo
[root@yue ~
]
3.安装
[root@yue ~
]yum
install mysql-community-server
4.启动
[root@yue ~
]service mysqld start
5.登录
[root@yue rabbit
]
apheMo2ypM-c
[root@yue ~
]mysql -uroot -p
6.修改密码
修改密码强验证(mysql 执行以下语句)
set global validate_password_policy
=0;
set global validate_password_mixed_case_count
=0;
set global validate_password_number_count
=3;
set global validate_password_special_char_count
=0;
set global validate_password_length
=3;
update user set password
=password
('123');
7.开启远程连接连接数据库
use mysql
;
select host
,user from user;
delete from user where user !=root
update user set host
='%';
8.修改编码
vim /etc/my.cnf
character-set-server
=utf8
collation-server
=utf8_general_ci
[mysql
]
default-character-set
=utf8
[mysql.server
]
default-character-set
=utf8
[mysqld_safe
]
default-character-set
=utf8
[client
]
default-character-set
=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
| /usr
/share/mysql
/charsets
/ |
+