centos7安装mysql

https://dev.mysql.com/downloads/mysql/5.7.html
选择Red Hat Enterprise Linux / Oracle Linux
下载:
mysql-community-client-5.7.33-1.el7.x86_64.rpm
mysql-community-common-5.7.33-1.el7.x86_64.rpm
mysql-community-libs-5.7.33-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.33-1.el7.x86_64.rpm
mysql-community-server-5.7.33-1.el7.x86_64.rpm
我没有用(mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar)


上传到centos7
yum -y install numactl
rpm -ivh mysql-community-client-5.7.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-common-5.7.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.33-1.el7.x86_64.rpm



启动配置mysql
vi  /etc/my.cnf
在[mysqld]下添加:
skip-grant-tables=1

service mysqld restart

mysql -u root -p
update user set host='%' where host='localhost';
update user set authentication_string = password('xxx'), password_expired = 'N', password_last_changed = now() where user = 'root';
再把上面的skip-grant-tables=1去掉,这样就可以密码登录了。

mysql5.7默认分组字段必须在查询字段里,修改这个配置:
mysql命令行,执行命令    
select @@sql_mode;
这样就可以查出sql_mode的值,复制这个值,在my.cnf中添加配置项(把查询到的值删掉only_full_group_by这个选项,其他的都复制过去):
sql_mode=STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION;    

再加一行,设置默认编码

character-set-server=utf8
文/程忠 浏览次数:0次   2021-02-22 11:59:36

相关阅读


评论: