MySQL root user is deleted

Source: Internet
Author: User

[Email protected] ~]# VI/ETC/MY.CNF [mysqld]skip-grant-tables

[[Email protected] ~]# service mysqld restartshutting down MySQL ... success! Starting MySQL. success!

mysql> INSERT INTO User (User,password,host) values (' Root ', ' ', ' localhost ');mysql> update user set host= ' localhost ', select_priv= ' y ', insert_priv= ' y ', update_priv= ' y ', delete_priv= ' y ', create_priv= ' y ', drop_priv= ' y ', reload_priv= ' Y ', shutdown_priv= ' y ', process_priv= ' y ', file_priv= ' y ', grant_priv= ' y ', references_priv= ' y ', index_priv= ' y ', create_ user_priv= ' y ', show_db_priv= ' y ', super_priv= ' y ', create_tmp_table_priv= ' y ', lock_tables_priv= ' y ', execute_priv= ' y ', repl_slave_priv= ' y ', repl_client_priv= ' y ', create_view_priv= ' y ', show_view_priv= ' y ', create_routine_priv= ' y ', alter _routine_priv= ' y ', create_user_priv= ' y ' where user= ' root '; Query OK, 1 row affected (0.05 sec) Rows matched:1 changed:1 warnings:0[[email protected] ~]# grep skip/etc/my.c NF #skip-grant-tablesskip-external-locking#skip-networkingslave-skip-errors = all[[email protected] ~]# Service mysqld restartshutting down MySQL. success! Starting MySQL. success!  [[email protected] ~]# mysqlwelcome to the MySQL Monitor. Commands enD with;  or \g.your MySQL connection ID is 3Server version:5.5.40-log mysql Community Server (GPL) Copyright (c) +, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> show databases;+--------------------+| Database |+--------------------+| Information_schema | | MySQL | | Performance_schema | |  Test |+--------------------+4 rows in Set (0.05 sec) mysql>

mysql> Update User  set Password=password ("123") where host= ' localhost '; Query OK, 1 row Affected (0.00 sec) Rows matched:1  changed:1  warnings:0mysql> flush privileges; Query OK, 0 rows Affected (0.00 sec)

[Email protected] ~]# mysql-uroot-p123welcome to the MySQL monitor.  

MySQL root user is deleted

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.