记一次阿里云 CentOS 7.4 64位部署项目之 mysql

1.安装mysql.

下载repo源  #  wget http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm

安装repo源  #  rpm -ivh mysql57-community-release-el7-7.noarch.rpm

获得/etc/yum.repos.d/mysql-community.repo/etc/yum.repos.d/mysql-community-source.repo两个源

开始安装 

# yum install mysql-server
# yum install mysql-devel
# yum install mysql
# rpm -qa | grep -i mysql

# service mysqld status 查看mysql当前的状态
# systemctl status mysqld

# service mysqld stop 停止mysql
#systemctl stop mysqld

# service mysqld restart 重启mysql
#systemctl restart mysqld

# service mysqld start 启动mysql
# systemctl start mysqld

设置mysql开机启动 # systemctl enable mysqld

启动mysql服务   systemctl start mysqld  或者 service mysqld start

 

设置跳过登录 在/etc/my.cnf中添加skip-grant-tables

重启 service mysqld restart  之后直接# mysql 进入mysql

 

然后重新设置密码:

mysql> use mysql;

mysql> show tables;

select user,authentication_string from user;


update mysql.user set authentication_string=password('your password') where user='root';


flush privileges;

exit;

 

修改密码策略:

set global validate_password_policy=0;
set global validate_password_length=1;

然后修改密码:

alter user 'root'@'localhost' identified by '新密码';

远程连接mysql:

1.阿里云开放3306端口,
2.修改mysql中user表host项,localhost改为 %;
3. use mysql;
  select host,user from user;
  update user set host = '%' where user ='root';
  flush privileges;(刷新权限相关表)
4.重启 service mysqld restart

 

mysql 忽略大小写:  lower_case_table_names=1

mysql 5.7  sql_mode ONLY_FULL_GROUP_BY :

  select @@global.sql_mode;

  Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column '数据库名.o.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

  解决:   my.cnf文件中:  sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

 

 

 

转载于:https://www.cnblogs.com/rempop/p/10522877.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值