zoukankan      html  css  js  c++  java
  • Mysql初始化root密码和允许远程访问

    mysql默认root用户没有密码,输入mysql –u root 进入mysql

    1、初始化root密码

    进入mysql数据库

    mysql>update user set password=PASSWORD('123456') where User='root';

    2、允许mysql远程访问,有以下几中方式

    如果不允许远程访问,会报如下的错误:

    ERROR 1130 (HY000): Host ‘1.2.3.4’ is not allowed to connect to this MySQL server

    (1)、Change mysql config

    vim /etc/mysql/my.cnf

    Comment out following lines.

    #bind-address           = 127.0.0.1
    #skip-networking

    If you do not find skip-networking line, add it and comment out it.

    Restart mysql server.

    /etc/init.d/mysql restart

    (2)、Change GRANT privilege

    Run a command like below to access from all machines. (Replace USERNAME and PASSWORD by your credentials.)

    mysql> GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

    Run a command like below to give access from specific IP. (Replace USERNAME and PASSWORD by your credentials.)

    mysql> GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'1.2.3.4' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

    Finally, you may also need to run:

    mysql> FLUSH PRIVILEGES;
  • 相关阅读:
    C++常用工具收集
    Ubuntu禁用触摸板
    Vim简本
    JS原型链模式和继承模式
    JS原型链模式
    JS中的单例模式/工厂模式/构造函数模式(并非完全意义上的设计模式)
    JS中一道关于this和闭包的题
    JS中的this关键字
    JS闭包
    JS作用域和作用域链
  • 原文地址:https://www.cnblogs.com/ahang/p/6805921.html
Copyright © 2011-2022 走看看