zoukankan      html  css  js  c++  java
  • mysql重置root密码,并设置可远程访问

    linux系统:

    ps aux |grep mysql

    kill -9 所有相关进程

    mysqld_safe --skip-grant-tables & mysql -u root use mysql UPDATE user SET host = '%' where USER = 'root';
    UPDATE user SET password=PASSWORD("123456") where USER = 'root';
    select user, host from user;
    
    flush privileges
    
    service mysqld restart

    window 系统

    mysql -u root -p
    
    use mysql;
    select host,user from user;
    
    update user set host = ’%’ where user = ’root’;
    
    Grant all on *.* to 'root'@'%' identified by 'root用户的密码' with grant option;
    flush privileges;

    drop database mybatisdb;
    drop user 'hr';
    create user 'hr'@'%' identified by '123456';
    create database mybatisdb;
    grant all privileges on mybatisdb.* to 'hr'@'%' identified by '123456';
    flush privileges;

    Mac

    MYSQL 1251错误解决:
    Create user 'hr2'@'%' identified by '123456';
    Grant all privileges on *.* to 'hr2'@'%' with grant option;
    Alter user 'hr2'@'%' identified by '123456' password expire never;
    Alter user 'hr2'@'%' identified with mysql_native_password by '123456';
    Flush privileges; MYSQL 1227错误解决: ERROR
    1227 (42000): Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this operation 原因:查看完MySQL8.0.16官方文档后得知,SYSTEM_USER是mysql新权限,并且在root用户下创建新用户xx时会授予SYSTEM_USER权限,而自己却没有SYSTEM_USER权限。 # xx用户下操作 mysql> grant system_user on *.* to root; Query OK, 0 rows affected (0.06 sec) # root用户下的操作 mysql> revoke all privileges on *.* from xiaokang; Query OK, 0 rows affected (0.02 sec)
  • 相关阅读:
    dijkstra (模板)
    LUOGU P2476 [SCOI2008]着色方案
    LUOGU P2344 奶牛抗议 (树状数组优化dp)
    LaTeX 公式大全
    LUOGU P1505 [国家集训队]旅游 (树链剖分+线段树)
    LUOGU P2416 泡芙 (缩点+树剖)
    LUGOU P1092 虫食算
    BZOJ 3090: Coci2009 [podjela] (树形背包)
    bzoj 4823 [Cqoi2017]老C的方块——网络流
    bzoj 3158 千钧一发——网络流
  • 原文地址:https://www.cnblogs.com/vvonline/p/9570204.html
Copyright © 2011-2022 走看看