Home Database Mysql Tutorial linux mysql root 密码忘记重置

linux mysql root 密码忘记重置

Jun 07, 2016 pm 03:46 PM
linux m mysql root stop password forget reset

1.停止mysql服务/etc/init.d/mysql stop 2.在终端输入 /usr/local/mysql/bin/mysqld_safe --skip-grant-tables --user=root此时mysql以跳过检测的模式运行 3.打开另一个终端 输入 mysql -uroot 进入mysql , mysqlupdate mysql.user set Password=PASSWORD('

1.    停止mysql服务 /etc/init.d/mysql stop
2.    在终端输入 /usr/local/mysql/bin/mysqld_safe --skip-grant-tables  --user=root 此时mysql以跳过检测的模式运行

3.    打开另一个终端 

       输入 mysql -uroot 进入mysql ,

       mysql> update mysql.user set Password=PASSWORD('密码') where user = 'root';
       mysql> FLUSH PRIVILEGES;
4.    退出mysql

5.    启动mysql服务    /etc/init.d/mysql start

完成。

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

Undress AI Tool

Undress AI Tool

Undress images for free

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.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

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)

How to change the GROUP_CONCAT separator in MySQL How to change the GROUP_CONCAT separator in MySQL Aug 22, 2025 am 10:58 AM

You can customize the separator by using the SEPARATOR keyword in the GROUP_CONCAT() function; 1. Use SEPARATOR to specify a custom separator, such as SEPARATOR'; 'The separator can be changed to a semicolon and plus space; 2. Common examples include using the pipe character '|', space'', line break character '\n' or custom string '->' as the separator; 3. Note that the separator must be a string literal or expression, and the result length is limited by the group_concat_max_len variable, which can be adjusted by SETSESSIONgroup_concat_max_len=10000; 4. SEPARATOR is optional

How to clean up your Linux system How to clean up your Linux system Aug 22, 2025 am 07:42 AM

Removeunusedpackagesanddependencieswithsudoaptautoremove,cleanpackagecacheusingsudoaptcleanorautoclean,andremoveoldkernelsviasudoaptautoremove--purge.2.Clearsystemlogswithsudojournalctl--vacuum-time=7d,deletearchivedlogsin/var/log,andempty/tmpand/var

How to use IFNULL() in MySQL? How to use IFNULL() in MySQL? Aug 22, 2025 pm 02:00 PM

IFNULL()inMySQLreturnsthefirstexpressionifitisnotNULL,otherwisereturnsthesecondexpression,makingitidealforreplacingNULLvalueswithdefaults;forexample,IFNULL(middle_name,'N/A')displays'N/A'whenmiddle_nameisNULL,IFNULL(discount,0)ensurescalculationslike

How to use the LIKE operator in MySQL How to use the LIKE operator in MySQL Aug 22, 2025 am 12:23 AM

TheLIKEoperatorinMySQLisusedtosearchforpatternsintextdatausingwildcards;1.Use%tomatchanysequenceofcharactersandtomatchasinglecharacter;2.Forexample,'John%'findsnamesstartingwithJohn,'%son'findsnamesendingwithson,'%ar%'findsnamescontainingar,'\_\_\_\_

An In-Depth Guide to Systemd for modern Linux Systems An In-Depth Guide to Systemd for modern Linux Systems Aug 23, 2025 pm 12:02 PM

Systemdisthefirstprocess(PID1)inmodernLinuxsystems,replacingolderinitsystemslikeSysVinitandUpstart,responsibleforbooting,managingservices,devices,logs,andusersessionsthroughasuiteofintegratedtools.2.Itusesunitfiles(.service,.timer,.socket,etc.)todefi

How to enable or disable the event scheduler in MySQL How to enable or disable the event scheduler in MySQL Aug 22, 2025 am 09:59 AM

Tochecktheeventschedulerstatus,useSHOWVARIABLESLIKE'event_scheduler';.2.Toenableordisabletemporarily,useSETGLOBALevent_scheduler=ONorOFF,whichremainseffectiveuntilthenextrestart.3.Toenableordisablepermanently,addevent_scheduler=ONorOFFunder[mysqld]in

How to handle deadlocks in MySQL? How to handle deadlocks in MySQL? Aug 22, 2025 am 04:25 AM

DeadlocksinMySQLoccurwhentransactionsblockeachotherbyholdingneededlocks,butcanbemanagedeffectivelythroughprevention,handling,andmonitoring.1.Minimizedeadlocksbyaccessingrowsinaconsistentorder,keepingtransactionssmallandfast,usinglowerisolationlevelsl

What is the EXPLAIN statement and how to use it in MySQL? What is the EXPLAIN statement and how to use it in MySQL? Aug 22, 2025 am 07:27 AM

EXPLAINinMySQLisusedtoanalyzequeryexecutionplanswithoutrunningthequery,helpingidentifyperformanceissues.1.UseEXPLAINbeforeaSELECT,INSERT,UPDATE,DELETE,orREPLACEstatement,mostcommonlywithSELECT.2.Keyoutputcolumnsincludeid,select_type,table,type,possib

See all articles