阿里 CSE 安装mysql 整理

安装步骤
    1. 1

      #######安装rpm包 

      [root@typecodes ~]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

    2. 2

      这时查看当前可用的mysql安装资源:

      [root@typecodes ~]# yum repolist enabled | grep "mysql.*-community.*"

      从上面的列表可以看出,mysql56-community/x86_64和MySQL 5.6 Community Server可以使用。

      因此,我们就可以直接用yum方式安装了MySQL5.6版本了。

      [root@typecodes ~]# yum -y install mysql-community-server

    3. 3

      #######安装成功后,将其加入开机启动 

      [root@typecodes ~]# systemctl enable mysqld

      扫描二维码关注公众号,回复: 2651669 查看本文章
    4. 4

      #######启动mysql服务进程 

      [root@typecodes ~]# systemctl start mysqld

    5. 5

      #######配置mysql(设置密码等) 

      [root@typecodes ~]# mysql_secure_installation

    6. 6

      [设置root用户密码]

      Remove anonymous users? [Y/n] y                 [删除匿名用户]

      Disallow root login remotely? [Y/n] y       [禁止root远程登录] 

      Remove test database and access to it? [Y/n] y          [删除test数据库]

      Reload privilege tables now? [Y/n] y            [刷新权限]

    7. 7

      #################设置mysql

      登陆:

      [root@typecodes ~]# mysql -u root -p

      创建用户:

      [root@typecodes ~]# insert into mysql.user(Host,User,Password,ssl_cipher,x509_issuer,x509_subject)values('localhost','baochengwx',password('baochengwx'),'','','');

      刷新权限:

      [root@typecodes ~]# FLUSH PRIVILEGES;  

      创建数据库:

      [root@typecodes ~]# create database companys;

      分配数据库给用户

      [root@typecodes ~]# grant all privileges on companys.* to companys identified by 'companys';

      修改密码

      UPDATE user SET Password=PASSWORD('newpassword') where USER='root'; 

      远程登陆

      user表中 Host列 'localhost' 改成 '%'  (也可以是固定ip、本地登陆localhost、%指不限登陆地址)

    8. 8

      MYSQL如何设置大小写敏感

      1、linux下mysql安装完后是默认:区分表名的大小写,不区分列名的大小写; 

      2、用root帐号登录后,在/etc/my.cnf 中的[mysqld]后添加添加lower_case_table_names=1,重启MYSQL服务(其中 0:区分大小写,1:不区分大小写 

  

远程连接配置

 show global variables like 'port'; 查看端口号

 mysql -u root -p;

 use mysql ;

 #将host设置为%表示任何ip都能连接mysql,当然也可指定为某个特定ip

 update user set host='%' where user='root' and host='localhost';

 flush privileges; #刷新权限表,使配置生效

  配置ecs安全组防火墙


猜你喜欢

转载自blog.csdn.net/Alan_00/article/details/81013087
cse