• liunx 下mysql 安装使用


    #1.停止mysql数据库
    /etc/init.d/mysqld stop
    #2.执行如下命令
    mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

    #或者在/etc/my.cnf
    最后一行添加
    skip-grant-tables(添加完这行保存后重启,service mysqd restart,重启后无需输入密码即可登录,修改完密码后,记得回过头把这行注释或取消掉)

    #3.使用root登录mysql数据库
    mysql -u root mysql
    #4.更新root密码
    mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
    #5.刷新权限
    mysql> FLUSH PRIVILEGES;
    #6.退出mysql
    mysql> quit
    #7.重启mysql
    /etc/init.d/mysqld restart
    #8.使用root用户重新登录mysql
    mysql -uroot -p
    Enter password: <输入新设的密码newpassword>


        MySQL安装
        安装
    rpm -ivh mysql-community-common-5.7.10-1.el6.x86_64.rpm --force --nodeps
    rpm -ivh mysql-community-libs-5.7.10-1.el6.x86_64.rpm --force --nodeps
    rpm -ivh mysql-community-client-5.7.10-1.el6.x86_64.rpm --force --nodeps
    rpm -ivh mysql-community-server-5.7.10-1.el6.x86_64.rpm --force --nodeps

    启动
    service mysqld start
    停止
    service mysqld stop

    使用安全模式启动
    mysqld_safe --user=mysql --skip-grant-tables --skip-networking&
    mysql  /**进入mysql交互窗口*
    UPDATE mysql.user SET authentication_string=PASSWORD('root') where USER='root';  
    /*5.7之后的版本user表中没有password字段*/
    flush privileges;
    exit;
    退出安全模式:
    service mysqld stop

    修改mysql编码,同时修改密码安全级别:
    vi /etc/my.cnf

    # reset pass level
    validate_password_policy = 0
    validate_password_length = 1
    validate_password_mixed_case_count = 0
    validate_password_number_count = 0
    validate_password_special_char_count = 0

    character_set_server=utf8
    default-storage-engine=INNODB
    collation-server=utf8_general_ci

    [client]
    default-character-set=utf8


    启动
    service mysqld start
    加入开机启动
    chkconfig mysqld on
    mysql -uroot -p

    执行sql命令
    SET PASSWORD = PASSWORD('root');
    flush privileges;

    use mysql;
    delete from user;
    授权
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'root' WITH GRANT OPTION;本地
    GRANT ALL PRIVILEGES ON *.* TO ' root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
    远程
    刷新权限
    flush privileges;

    创建HIVE连接用户:
    mysql -uroot -proot
    create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
    授权本地连接:
    GRANT ALL PRIVILEGES ON hive.* TO 'hive'@'localhost' IDENTIFIED BY 'hive' WITH GRANT OPTION;
    授权远程连接:
    GRANT ALL PRIVILEGES ON hive.* TO 'hive'@'%' IDENTIFIED BY 'hive' WITH GRANT OPTION;
    提交:
    FLUSH PRIVILEGES;

  • 相关阅读:
    DOM操作 append prependTo after before
    Vue(2)- v-model、局部组件和全局组件、父子组件传值、平行组件传值
    Vue(1)- es6的语法、vue的基本语法、vue应用示例,vue基础语法(转)
    Linux环境下虚拟环境virtualenv安装和使用(转)
    REST、DRF(View源码解读、APIView源码解读)
    超哥的 LINUX 入门大纲
    redis入门
    CRM总结
    如何搭建一个vue项目(完整步骤)
    DRF 视图
  • 原文地址:https://www.cnblogs.com/lqCnblog/p/6740083.html
Copyright © 2020-2023  润新知