Centos7.4离线安装mysql5.5.62
本次使用的安装方法为rpm安装,安装包已打包,一键安装即可,安装前需先安装依赖(已打包整体安装即可)
mysql
mysql安装的相关依赖
上传安装包及依赖
# cd mysqlyl
# rpm -ivh --force --nodeps *.rpm
# cd ../mysql
# rpm -ivh --force --nodeps *.rpm
结果基于系统信息输出结果
# mysqladmin --version
启动mysql
# systemctl start mysqld
查看mysql运行状态
# systemctl status mysqld
设置mysql开机自启
# systemctl enable mysqld
进行登录(默认情况下没有密码,直接按enter进入即可)
# mysql -uroot -p
修改数据库默认字符集为utf8mb4
mysql> show variables like 'char%';
# vi /etc/my.cnf
[client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
[mysqld]
character-set-server=utf8mb4
保存退出,重新启动mysql
# systemctl restart mysqld
再次登陆mysql查询当前字符集:
数据库的字符集已经被修改
使用 Navicat 登录mysql:
先修改root的登录密码
# mysql -uroot -p
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
刷新系统权限
mysql> flush privileges;
mysql> exit;
# mysql -uroot -p
输入密码
mysql> use mysql;
允许远程机器连接
mysql> update user set host = '%' where user = 'root';
(授权)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
mysql> select host, user from user;
mysql> flush privileges;
mysql> exit;
//注意一定要重启才生效
systemctl restart mysqld;
重启后使用Navicat 登录mysql即可