共计 820 个字符,预计需要花费 3 分钟才能阅读完成。
常用命令
// 启动 | |
> service mysqld start | |
// 关闭 | |
> service mysqld stop | |
// 重启 | |
> service mysqld restart |
安装之前先安装基本环境:
> yum install -y perl perl-Module-Build net-tools autoconf libaio numactl-libs
安装 mysql
# 下载 mysql 源安装包 | |
> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm | |
# 安装 mysql 源 | |
> yum localinstall mysql57-community-release-el7-8.noarch.rpm |
检查 mysql 源是否安装成功
> yum repolist enabled | grep "mysql.*-community.*"
安装 mysql
> yum install mysql-community-server
启动 mysql
> systemctl start mysqld
查看 mysql 状态
> systemctl status mysqld
开机启动
> systemctl enable mysqld | |
> systemctl daemon-reload |
修改 root 本地密码
// 查看初始密码 | |
> grep 'temporary password' /var/log/mysqld.log | |
// 设置新密码 | |
> set password for 'root'@'localhost'=password('MyNewPass4!'); |
添加远程账户
> GRANT ALL PRIVILEGES ON *.* TO 'testName'@'%' IDENTIFIED BY 'passWord' WITH GRANT OPTION;
配置 UTF-8 编码
> vim /etc/my.cnf | |
// 添加编码 | |
[mysqld] | |
character_set_server=utf8 | |
init_connect='SET NAMES utf8' |
正文完