Home Database Mysql Tutorial mysql数据库ROOT账号权限丢失问题解决方法

mysql数据库ROOT账号权限丢失问题解决方法

Jun 07, 2016 pm 04:15 PM
mysql root lost database Permissions solve account question

ROOT账号权限丢失了我们就几乎不能做很多的事情了,今天本文章来为各位介绍mysql数据库ROOT账号权限丢失问题解决方法吧,希望文章可以帮助到各位. 数据库的操作软件有很多,在线的话phpmyadmin是非常不错的软件, 比较坑爹的是我的一个机器用的是amh的面板,

   ROOT账号权限丢失了我们就几乎不能做很多的事情了,今天本文章来为各位介绍mysql数据库ROOT账号权限丢失问题解决方法吧,希望文章可以帮助到各位.

  数据库的操作软件有很多,在线的话phpmyadmin是非常不错的软件,

  比较坑爹的是我的一个机器用的是amh的面板,遇到了一件无比郁闷的事.

  大家都知道在没有独立安装phpmyadmin的情况下,amh面板的数据库操作是AMYSQL…

  这个软件。。。怎么说呢,操作不当,引起的后果可是灰常严重的。(其他软件操作不当也会出大事)

  由于想给网站提速,数据库要迁移到阿里云RDS,数据库的迁移当然最简单的方法是直接迁移,这里就需要我们开放源数据库的远程连接.

  由于安全问题,我们默认的时候把数据库的链接设置的都是本地localhost,那么我们需要改为%。。OK 无比郁闷的是我在改为%之后,在amysql面板操作的,

  竟然直接导致我的root账号没有任何权限….直接等于账号被锁定。。root没有任何操作权限。。尼玛..

  对于我这样的计算机小白来说,这尼玛让我泪奔啊,刚开始不知道什么原因的时候我差点都要回滚磁盘了有木有….

  没办法,只能自己先折腾了。

  ———————————————————–

  解决办法: 首先.你要有服务器的root权限,,不然….那还搞什么啊..

  (这里介绍一个很使用的命令:skip-grant-tables →非常有用的mysql启动参数)

  先停止mysql的运行;这里建议是正常停止mysql,尽量不要pkill,因为你的pkill可能导致mysqld dead but subsys locked.

  如果已经pkill了那就再mysqld status下喽.然后再stop.

  然后运行# mysqld_safe –skip-grant-tables &

  &,表示在后台运行,,不再后台运行的话,就再打开一个终端咯。这个&很实用哦~!

  然后mysql进入我们的数据库,跳过验证了,也就不必那么麻烦 直接mysql进入

  然后 use mysql;

  我们这里呢介绍下实用update赋予root账号权限.

  update user set Update_priv =’Y’ where user = ‘root';

  如果像我这样没有了所有权限。。。

  更新的MYSQL.USER表的所有字段中为N的为Y就可以了。

  update user set Select_priv ='Y' where user = 'root';

  update user set Insert_priv ='Y' where user = 'root';

  update user set Update_priv ='Y' where user = 'root';

  update user set Delete_priv ='Y' where user = 'root';

  update user set Create_priv ='Y' where user = 'root';

  update user set Drop_priv ='Y' where user = 'root';

  update user set Reload_priv ='Y' where user = 'root';

  update user set Shutdown_priv ='Y' where user = 'root';

  update user set Process_priv ='Y' where user = 'root';

  update user set File_priv ='Y' where user = 'root';

  update user set Grant_priv ='Y' where user = 'root';

  update user set References_priv ='Y' where user = 'root';

  update user set Index_priv ='Y' where user = 'root';

  update user set Alter_priv ='Y' where user = 'root';

  update user set Show_db_priv ='Y' where user = 'root';

  update user set Super_priv ='Y' where user = 'root';

  update user set Create_tmp_table_priv ='Y' where user = 'root';

  update user set Lock_tables_priv ='Y' where user = 'root';

  update user set Execute_priv ='Y' where user = 'root';

  update user set Repl_slave_priv ='Y' where user = 'root';

  update user set Repl_client_priv ='Y' where user = 'root';

  update user set Create_view_priv ='Y' where user = 'root';

  update user set Show_view_priv ='Y' where user = 'root';

  update user set Create_routine_priv ='Y' where user = 'root';

  update user set Alter_routine_priv ='Y' where user = 'root';

  update user set Create_user_priv ='Y' where user = 'root';

  update user set Event_priv ='Y' where user = 'root';

  update user set Trigger_priv ='Y' where user = 'root';

mysql数据库ROOT账号权限丢失问题解决方法  三联

  权限问题最后要保证“mysql.user”表中 host为“localhost”和“%”都有root的所有权限。

  OK啦,如果你想修改下密码顺手再改root的数据库密码吧,不过改后记得要修改网站相对应文件啊

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Enable root permissions with one click (quickly obtain root permissions) Enable root permissions with one click (quickly obtain root permissions) Jun 02, 2024 pm 05:32 PM

It allows users to perform more in-depth operations and customization of the system. Root permission is an administrator permission in the Android system. Obtaining root privileges usually requires a series of tedious steps, which may not be very friendly to ordinary users, however. By enabling root permissions with one click, this article will introduce a simple and effective method to help users easily obtain system permissions. Understand the importance and risks of root permissions and have greater freedom. Root permissions allow users to fully control the mobile phone system. Strengthen security controls, customize themes, and users can delete pre-installed applications. For example, accidentally deleting system files causing system crashes, excessive use of root privileges, and inadvertent installation of malware are also risky, however. Before using root privileges

How to use MySQL backup and restore in PHP? How to use MySQL backup and restore in PHP? Jun 03, 2024 pm 12:19 PM

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

How to optimize MySQL query performance in PHP? How to optimize MySQL query performance in PHP? Jun 03, 2024 pm 08:11 PM

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

How to create a MySQL table using PHP? How to create a MySQL table using PHP? Jun 04, 2024 pm 01:57 PM

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

How to fix mysql_native_password not loaded errors on MySQL 8.4 How to fix mysql_native_password not loaded errors on MySQL 8.4 Dec 09, 2024 am 11:42 AM

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

See all articles