zoukankan      html  css  js  c++  java
  • centos7 mysql安装与用户设置

    1、环境:Centos 7.0 64位
    2、mysql版本:5.7
    3、安装:https://dev.mysql.com/doc/refman/5.7/en/installing.html
    3.1、创建mysql用户和组:https://dev.mysql.com/doc/refman/5.7/en/binary-installation.html
    3.2、忘记 linux下mysql5.7 root用户的密码:
    service mysqld stop
    修改/etc/my.inf 末尾添加 skip-grant-tables
    service mysqld start
    use mysql
    update user set authentication_string=password('Kd8k&dfdl023') where user='root';
    flush privileges;

    将/etc/my.inf中的skip-grant-tables 删掉;
    service mysqld restart
    mysql -uroot -p
    use mysql
    set password=password('newpassword');
    3.3、创建mysql用户
    https://dev.mysql.com/doc/refman/5.7/en/adding-users.html
    mysql> CREATE USER 'finley'@'localhost' IDENTIFIED BY 'some_pass';
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'trade'@'%' WITH GRANT OPTION;
    3.5、查看mysql端口:
    mysql> show variables like 'port';
    3.4、打开防火墙配置文件:
    关闭并禁止firewall开机启动:
    停止
    systemctl stop firewalld.service
    禁止开机启动
    systemctl disable firewalld.service
    安装iptables防火墙
    yum install iptables-services
    编辑防火墙配置文件打开指定的端口号使用udp协议打开52100端口:
    vi /etc/sysconfig/iptables
    保存退出
    :wq
    最后重启防火墙使配置生效
    systemctl restart iptables.service
    设置防火墙开机启动
    systemctl enable iptables.service

    3.5、查询mysql配置文件
    locate my.cnf
    查看mysql默认读取的配置列表:
    mysql --help|grep 'my.cnf'
    查看3306端口信息:
    netstat -apn|grep 3306
    修改mysql设置中的bind-address选项:
    bind-address = 0.0.0.0
    修改mysql设置中的port选项:
    port=3308
    ----->使用阿里云服务器,需额外配置阿里云安全规则,设置入场端口!!!!!(巨坑。。)

    4、创建数据库和数据表们:见sql文件。
    5、centos设置cmd为支持中文
    echo $LANG
    yum group list
    yum install system-config-users
    yum groupinstall chinese-support


    5.1、linux设置mysql编码为utf-8

    6、linux 命令执行.sql文件
    登录mysql
    执行 source sqlpath



  • 相关阅读:
    4-1 R语言函数 lapply
    3-6 向量化操作
    3-5 处理缺失值
    3-4 列表的子集
    3-3 数据框的子集
    3-2 矩阵的子集
    bootstrap 模式对话框
    手机端 超链接 识别电话号码
    jQuery设置和获取HTML、文本和值
    TP 框架 ajax[利用异步提交表单]
  • 原文地址:https://www.cnblogs.com/lindsay-chh/p/7089860.html
Copyright © 2011-2022 走看看