zoukankan      html  css  js  c++  java
  • 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;

  • 相关阅读:
    使用ACEGI搭建权限系统:第三部分
    分支在版本树中的应用(使用subversion)
    acegi安全框架使用:第二部分
    错误数据导致java.lang.IllegalArgumentException:Unsupported configuration attributes
    移动中间件和wap网关的比较
    3年后,又回到了.net阵营
    android中listView的几点总结
    oracle相关分布式数据解决方案
    ajax实现用户名存在校验
    使用template method模式简化android列表页面
  • 原文地址:https://www.cnblogs.com/lqCnblog/p/6740083.html
Copyright © 2011-2022 走看看