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 忽略大小写:  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

 

 


 
posted @ 2019-03-13 14:30  Cxvvy  阅读(193)  评论(0编辑  收藏  举报