zoukankan      html  css  js  c++  java
  • Mysql安装与配置调优

    一、安装
    apt-get install mysql-server 需要设置账号密码
    apt-get isntall mysql-client
    apt-get libmysqlclient-dev
    2.sudo netstat -tap | grep mysql 查看是否安装成功
    root@xyz:~# netstat -tap | grep mysql
    tcp6       0      0 [::]:mysql              [::]:*                  LISTEN      7510/mysqld  -->安装成功

    二、设置mysql远程访问

    1. 编辑mysql配置文件,把其中bind-address = 127.0.0.1注释了

    vi /etc/mysql/mysql.conf.d/mysqld.cnf 

    2. 使用root进入mysql命令行,执行如下2个命令,示例中mysql的root账号密码:root

    grant all on *.* to root@'%' identified by 'root' with grant option;
    flush privileges;

    3. 重启mysql

    /etc/init.d/mysql restart

    三、MySQL修改root密码的多种方法

    方法1: 用SET PASSWORD命令

      mysql -u root
    
      mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');

    方法2:用mysqladmin

      mysqladmin -u root password "newpass"
    
      如果root已经设置过密码,采用如下方法
    
      mysqladmin -u root password oldpass "newpass"

    方法3: 用UPDATE直接编辑user表

      mysql -u root
    
      mysql> use mysql;
    
      mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';
    
      mysql> FLUSH PRIVILEGES;

         在丢失root密码的时候,可以这样

        mysqld_safe --skip-grant-tables&

        mysql -u root mysql

        mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root';

        mysql> FLUSH PRIVILEGES;



    生命不止,奋斗不息
  • 相关阅读:
    使用Docker在本地搭建Hadoop分布式集群
    微博推荐 第三个map 源码
    对象
    http无状态(stateless)
    理解http的无连接
    http响应报文之首部行
    http响应报文之状态行
    http响应报文
    http请求报文之首部行
    http请求之请求数据
  • 原文地址:https://www.cnblogs.com/shione/p/7249304.html
Copyright © 2011-2022 走看看