


Detailed explanation of the solution to forgetting the MySQL root password in MACOS
This article mainly tells you the actual steps to reset the root password in the MAC system MySQL. It often happens that you forget the MySQL root password in actual operations. The following is the summary of this tutorial. Detailed content introduction.
MySQL is a relational database management system developed by the Swedish MySQL AB company and is currently a product of Oracle. MySQL is one of the most popular relational database management systems. In terms of WEB applications, MySQL is the best RDBMS (Relational Database Management System) application software.
MySQL is a relational database management system. A relational database stores data in different tables instead of placing all data in one large warehouse, which increases speed and flexibility.
The SQL language used by MySQL is the most commonly used standardized language for accessing databases. MySQL software adopts a dual licensing policy and is divided into community version and commercial version. Due to its small size, fast speed, low total cost of ownership, and especially the characteristics of open source, MySQL is generally chosen as the website database for the development of small and medium-sized websites.
After installing MySQL on Mac, the software will generate a default password for us. However, when I use Navicat to establish a connection, it prompts that the password is invalid. I have no choice but to change the database default password.
Next, record the entire root password modification process.
The mysql service must be stopped before starting the following steps!
cd /usr/local/mysql/bin/ sudo su ./mysqld_safe --skip-grant-tables & //这一步的作用是跨过权限验证 ./mysql -uroot //以root身份登录,因为第三步的原因不需要密码了。这之后的命令就不需要在前面加./mysql了 use mysql; update user set authentication_string='123456' where User='root';
The versions circulating on the Internet are all set password =‘’. When writing this way, an error is always reported saying that the ‘password’ column does not exist!
Finally, I used the sql command to find out that there is only the authentication_string field and no password field.
After executing the previous step, I thought I could log in, but during the navicat connection test, an error message appeared:
ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.
So the following steps are needed
cd /usr/local/mysql/bin/ sudo su ./mysql -uroot -p123456 set password = password('123456')
Username: root, password :12345
Modification successful
Supplement:Although the above modification was successful, it still took many detours. The above just records the whole process. Below we will The simplest and most effective way to summarize
is that this process is sad. There is so much information on the Internet. The key is that everyone has their own wrong methods. After trying for a long time, no one is right. I am about to break the psychological defense line. When I went to read the MySQL documentation, I made the change successfully. No article gave me the complete answer. I consulted several guides and built the car behind closed doors. Give yourself a thumbs up. Without further ado, just follow me step by step.
1. Close the mysql server
sudo /usr/local/mysql/support-files/mysql.server stop
You can also close it in MySQL in the system preferences.
2.cd /usr/local/mysql/bin Enter the directory
##3.sudo su Obtain permissions
4. ./mysqld_safe --skip-grant-tables & Restart the server
alias mysql=/usr/local/mysql/bin/mysql
flush privileges;Probably just get the permissions, otherwise he won’t let you change it.
set password for 'root'@'localhost'=password('new password'); Complete the modification
The above is the detailed content of Detailed explanation of the solution to forgetting the MySQL root password in MACOS. For more information, please follow other related articles on the PHP Chinese website!

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

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

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

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)
