Home Database Mysql Tutorial What should I do if I forget mysql default password under centos?

What should I do if I forget mysql default password under centos?

Oct 16, 2020 am 09:43 AM
centos mysql

Solution: 1. Use the "grep 'temporary password' /var/log/mysqld.log" command to retrieve the initial password during installation; 2. Modify the configuration file "my.cnf" to avoid Log in to the mysql server with your password and use the update command to set a new password.

What should I do if I forget mysql default password under centos?

The operating environment of this tutorial: CentOS 6 system, mysql8 version, Dell G3 computer.

Solution to the forgotten mysql default password under centos

Method 1. Retrieve the initial password during installation:

Execute the following command directly

grep 'temporary password' /var/log/mysqld.log
Copy after login

What should I do if I forget mysql default password under centos?

##Method 2. Configure the my.cnf file, log in to the mysql server without a password, and use the update command Set a new password

1. Modify the configuration file and log in to the mysql server without a password

#vim /etc/my.cnf(Note: windows The modification below is my.ini)

Add any line after [mysqld]

explicit_defaults_for_timestamp=true
skip-grant-tables
Copy after login

Save and exit

Restart mysql

service mysqld restart
Copy after login

Log in to mysql directly

mysql -uroot
Copy after login

What should I do if I forget mysql default password under centos?

2. Change password

use mysql
update user set authentication_string=password(“123456”) where user=“root”;
Copy after login

What should I do if I forget mysql default password under centos?

(Recommended tutorial:

mysql video tutorial)

The above is the detailed content of What should I do if I forget mysql default password under centos?. For more information, please follow other related articles on the PHP Chinese website!

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)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months 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)

CentOS Stream 8 troubleshooting methods CentOS Stream 8 troubleshooting methods Apr 14, 2025 pm 04:33 PM

CentOSStream8 system troubleshooting guide This article provides systematic steps to help you effectively troubleshoot CentOSStream8 system failures. Please try the following methods in order: 1. Network connection testing: Use the ping command to test network connectivity (for example: pinggoogle.com). Use the curl command to check the HTTP request response (for example: curlgoogle.com). Use the iplink command to view the status of the network interface and confirm whether the network interface is operating normally and is connected. 2. IP address and gateway configuration verification: Use ipaddr or ifconfi

How to train PyTorch model on CentOS How to train PyTorch model on CentOS Apr 14, 2025 pm 03:03 PM

Efficient training of PyTorch models on CentOS systems requires steps, and this article will provide detailed guides. 1. Environment preparation: Python and dependency installation: CentOS system usually preinstalls Python, but the version may be older. It is recommended to use yum or dnf to install Python 3 and upgrade pip: sudoyumupdatepython3 (or sudodnfupdatepython3), pip3install--upgradepip. CUDA and cuDNN (GPU acceleration): If you use NVIDIAGPU, you need to install CUDATool

How to choose the PyTorch version under CentOS How to choose the PyTorch version under CentOS Apr 14, 2025 pm 02:51 PM

When selecting a PyTorch version under CentOS, the following key factors need to be considered: 1. CUDA version compatibility GPU support: If you have NVIDIA GPU and want to utilize GPU acceleration, you need to choose PyTorch that supports the corresponding CUDA version. You can view the CUDA version supported by running the nvidia-smi command. CPU version: If you don't have a GPU or don't want to use a GPU, you can choose a CPU version of PyTorch. 2. Python version PyTorch

Troubleshooting methods for Zookeeper on CentOS Troubleshooting methods for Zookeeper on CentOS Apr 14, 2025 pm 04:30 PM

ZooKeeper troubleshooting guide for CentOS Systems This article provides a step-by-step guide to help you effectively troubleshoot ZooKeeper faults on CentOS systems. 1. Verify the status of ZooKeeper service: First, use the following command to check the status of ZooKeeper service: sudosystemctlstatuszookeeper If the service is not running, use the following command to start: sudosystemctlstartzookeeper To enable it to start by starting: sudosystemctlenablezookeeper2. Analyze the ZooKeeper log to check Z

How to configure slow query log in centos redis How to configure slow query log in centos redis Apr 14, 2025 pm 04:54 PM

Enable Redis slow query logs on CentOS system to improve performance diagnostic efficiency. The following steps will guide you through the configuration: Step 1: Locate and edit the Redis configuration file First, find the Redis configuration file, usually located in /etc/redis/redis.conf. Open the configuration file with the following command: sudovi/etc/redis/redis.conf Step 2: Adjust the slow query log parameters in the configuration file, find and modify the following parameters: #slow query threshold (ms)slowlog-log-slower-than10000#Maximum number of entries for slow query log slowlog-max-len

What are the security policies of php on centos What are the security policies of php on centos Apr 14, 2025 pm 02:33 PM

Detailed explanation of CentOS server PHP security policy: Building a solid protection system This article will explore in-depth how to build a secure PHP operating environment on the CentOS system, covering multiple aspects such as system level, PHP configuration, permission management, HTTPS encryption and security monitoring, etc., to help you effectively reduce the risk of server attacks. Server security is a continuous improvement process that requires regular review and updates to security policies. 1. System security cornerstone system update: Keep the latest version of the CentOS system and all software packages, install security patches in a timely manner, and plug known vulnerabilities. Firewall protection: Use Firewalld to finely control server network access, and only necessary ports (such as HTTP port 80 and H

What is the CentOS MongoDB backup strategy? What is the CentOS MongoDB backup strategy? Apr 14, 2025 pm 04:51 PM

Detailed explanation of MongoDB efficient backup strategy under CentOS system This article will introduce in detail the various strategies for implementing MongoDB backup on CentOS system to ensure data security and business continuity. We will cover manual backups, timed backups, automated script backups, and backup methods in Docker container environments, and provide best practices for backup file management. Manual backup: Use the mongodump command to perform manual full backup, for example: mongodump-hlocalhost:27017-u username-p password-d database name-o/backup directory This command will export the data and metadata of the specified database to the specified backup directory.

What is the backup and recovery process of GitLab on CentOS What is the backup and recovery process of GitLab on CentOS Apr 14, 2025 pm 02:36 PM

GitLab backup and recovery guide for CentOS system This article details how to backup and restore GitLab on CentOS system to ensure that your GitLab data is safe and reliable. Backup process Create backup: Use the command gitlab-rakegitlab:backup:create to create a complete backup of GitLab, including all key information such as Git repository, database, users, user groups, keys and permissions. The default backup file is stored in the /var/opt/gitlab/backups directory. You can modify gitlab_rails[' in the /etc/gitlab/gitlab.rb file

See all articles