Linux MySQL 密码修改
1)如果您没有忘记密码的情况下,可以通过UPDATE直接编辑user表来修改密码: 进入数据库mysql -u rootmysqlgt; use mysql;mysql
1)如果您没有忘记密码的情况下,可以通过UPDATE直接编辑user表来修改密码:
进入数据库mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';
mysql> FLUSH PRIVILEGES;
或者
/etc/init.d/mysql stop
/etc/init.d/mysql start
2)如果您已经忘记密码:
# /etc/init.d/mysql stop 1、结束当前正在运行的mysql进程。
# /usr/bin/mysqld_safe --skip-grant-tables 2、用mysql安全模式运行并跳过权限验证。
# mysql -u root 3、重开一个终端以root身份登录mysql。
mysql> use mysql; 4、修改root用户口令。
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set Password = PASSWORD('root') where User ='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> exit
# /etc/init.d/mysql restart 5、结束mysql安全模式,用正常模式运行mysql。
mysql> update mysql.user set password=PASSWORD('新密码') where User='root';
6、试试你新修改的口令
mysql> flush privileges;
mysql> quit

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Reduce the use of MySQL memory in Docker

How do you alter a table in MySQL using the ALTER TABLE statement?

How to solve the problem of mysql cannot open shared library

Run MySQl in Linux (with/without podman container with phpmyadmin)

What is SQLite? Comprehensive overview

Running multiple MySQL versions on MacOS: A step-by-step guide

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?

How do I configure SSL/TLS encryption for MySQL connections?
