centos7 安装mysql
1.下载MySQL资源
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
2.安装
yum -y install mysql57-community-release-el7-10.noarch.rpm
3.安装MySQL服务器
yum -y install mysql-community-server
4.启动MySQL服务
systemctl start mysqld
#查看MySQL的启动状态
systemctl status mysqld
#开机启动
systemctl enable mysqld
systemctl daemon-reload
5.登录root用户及修改密码
mysql -u root -p
set password for 'root'@'localhost'=password('MyNewPd');
6.添加远程登录用户
默认只允许root帐户在本地登录,如果要在其它机器上连接mysql,必须修改root允许远程连接,或者添加一个允许远程连接的帐户,为了安全起见,我添加一个新的帐户:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'yangxin'@'%' IDENTIFIED BY 'Yangxin0917!' WITH GRANT OPTION;
#如果不需要密码策略,添加my.cnf文件中添加如下配置禁用即可:
validate_password = off
#重新启动mysql服务使配置生效:
systemctl restart mysqld
7、配置默认编码为utf8
修改/etc/my.cnf配置文件,在[mysqld]下添加编码配置,如下所示:
[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'
8.默认配置文件路径:
配置文件:/etc/my.cnf
日志文件:/var/log//var/log/mysqld.log
服务启动脚本:/usr/lib/systemd/system/mysqld.service
socket文件:/var/run/mysqld/mysqld.pid
Flask学习