Table of Contents
After installing MySQL on MacOS through the DMG file. . . .
error2
Home Database Mysql Tutorial collect! Solution to error reported after MacOSS installs MySQL through DMG file

collect! Solution to error reported after MacOSS installs MySQL through DMG file

Jul 25, 2018 pm 04:17 PM
mysql error

Not everyone will encounter errors when installing MySQL on MacOS, but I have indeed encountered them. There are many pitfalls. Solving these problems independently is also a check on your basic knowledge, so I prefer that everyone first Check independently, and if it still doesn't work, read below.

After installing MySQL on MacOS through the DMG file. . . .

You may encounter these two headaches:

error1

Unable to connect to host 127.0.0.1 because access was denied.

Double-check your username and password and ensure that access from your current location is permitted.

MySQL said: Access denied for user 'root'@'localhost' (using password: YES)
Copy after login
Copy after login

error2

Unable to connect to host 127.0.0.1, or the request timed out.

Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).

MySQL said: Your password has expired. To log in you must change it using a client that supports expired passwords.
Copy after login

Not everyone will encounter this problem, but I have indeed encountered them all, and there are many pitfalls here. Solving these problems independently is also a check on your own basic knowledge, so I prefer that everyone investigate independently first, and if they are still not solved, then read the following. In addition, if you are in the Homestead environment officially recommended by laravel, you may not encounter these problems. But I am a person who loves to mess around. I especially like debugging and typing things in the command line, so I solved this problem and share it with you.

First, let’s reproduce the entire process starting from installing MySQL.

1. Download the MySQL dmg installation package from the mysql official website: https://dev.mysql.com/downloads/mysql/

2. After downloading the dmg file, double-click to install it. Note When you reach the last step, a prompt box will pop up:

collect! Solution to error reported after MacOSS installs MySQL through DMG file

root@localhost W:ivGGB5lrdS at the end is the initial password given to you when MySQL was installed. This is very important. Be sure to write it down.

3. Start MySQL:
Enter Mac’s System Preferences

collect! Solution to error reported after MacOSS installs MySQL through DMG file

collect! Solution to error reported after MacOSS installs MySQL through DMG file

## 4. After starting MySQL, I chose the software Sequel pro to operate the database.

collect! Solution to error reported after MacOSS installs MySQL through DMG file

At this time, the two previous errors will appear,

the
error1 mentioned above means your MySQL account password There is a mistake. I set up the database-related configuration in the .env file of the laravel project at the beginning, so I directly input the configuration in the .env file, and then it will prompt

Unable to connect to host 127.0.0.1 because access was denied.

Double-check your username and password and ensure that access from your current location is permitted.

MySQL said: Access denied for user 'root'@'localhost' (using password: YES)
Copy after login
Copy after login

Also

error2 In the error, the error message means: password has expired, which actually means that you cannot log in with the initial password you just installed MySQL. You need to reset your MySQL password and then use a new password. Let’s log in to the root account and let’s solve this problem.

First enter MySQL in command line mode

collect! Solution to error reported after MacOSS installs MySQL through DMG file

If nothing unexpected happens, you will see a prompt

mysql command not found
Copy after login

This is because We installed MySQL through a dmg file package. The system does not know MySQL. We need to add the MySQL path to the bash file (my command line tool uses zsh. Everyone uses it differently, but the idea is the same. Yes, just add the MySQL path to the bash file)

Open the bash file first, and then add the MySQL path.

collect! Solution to error reported after MacOSS installs MySQL through DMG file

Enter the following line of command in the opened file, save and exit to use MySQL commands on the command line.

export PATH=$PATH:/usr/local/mysql/bin
Copy after login

collect! Solution to error reported after MacOSS installs MySQL through DMG file

After that, we need to reset the password of the MySQL root account, enter

mysql -u root -p
Copy after login

on the command line and then enter the initial password provided by MySQL. If The following prompt appears, indicating that we have entered the MySQL settings

295308797-5b52c932a8c7a_articlecollect! Solution to error reported after MacOSS installs MySQL through DMG file

At this time, we enter

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('你想要设置的root账户的新密码');
Copy after login
after mysql > When we see

collect! Solution to error reported after MacOSS installs MySQL through DMG file

means that the password reset is successful, and then when we open Sequel pro and enter the root account and new password, it can be used.

collect! Solution to error reported after MacOSS installs MySQL through DMG file

collect! Solution to error reported after MacOSS installs MySQL through DMG file

Related recommendations:

After installing MySQL, an error errorNr.1364## was reported in the last step of configuration.

#Detailed graphic and text explanation of encoding settings for MySQL installation

Video tutorial: Install mysql-Alibaba Cloud environment construction and project launch

The above is the detailed content of collect! Solution to error reported after MacOSS installs MySQL through DMG file. 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)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
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)

Duplicate entry for key 'PRIMARY' - How to solve MySQL error: Duplicate record of primary key Duplicate entry for key 'PRIMARY' - How to solve MySQL error: Duplicate record of primary key Oct 05, 2023 pm 02:49 PM

How to solve MySQL error: Duplicate primary key records, specific code examples are needed. When using MySQL database, we often encounter the problem of duplicate primary key records. When we insert a new piece of data into the database, if the primary key value of the data is the same as the primary key value of an existing record, a duplicate primary key record error will occur. The prompt for this error is usually "Duplicatetryforkey'PRIMARY'". So, how to solve this problem? This article will provide several solutions

Table 'table_name' already exists - How to solve MySQL error: table already exists Table 'table_name' already exists - How to solve MySQL error: table already exists Oct 05, 2023 am 09:25 AM

Table'table_name'alreadyexists-How to solve MySQL error: The table already exists, specific code examples are needed. Introduction: During the development and management process of using MySQL database, you often encounter errors that the table already exists. This error usually occurs when creating a table repeatedly or when importing an existing table structure. This article will introduce how to solve the problem of MySQL error: table already exists, and provide specific code examples. 1. What is MySQL error: Table has been

Cannot add or update a child row: a foreign key constraint fails - How to solve MySQL error: child row has foreign key constraint Cannot add or update a child row: a foreign key constraint fails - How to solve MySQL error: child row has foreign key constraint Oct 05, 2023 am 08:22 AM

How to solve the MySQL error: The child row has foreign key constraints, specific code examples are needed. When using the MySQL database, we may encounter the error "Cannotaddorupdateachildrow:aforeignkeyconstraintfails". This error usually indicates a foreign key constraint problem when inserting or updating data. This article explains how to solve this problem and provides specific code examples. First, let's deal with

Data too long for column 'column_name' - How to solve MySQL error: data exceeds field length Data too long for column 'column_name' - How to solve MySQL error: data exceeds field length Oct 05, 2023 am 08:29 AM

How to solve MySQL error: The data exceeds the field length, specific code examples are needed. During the development process of using MySQL database, we often encounter the problem that the data exceeds the field length. When we insert or update data, if the length of the data exceeds the defined length of the field, MySQL will report an error and prevent the data insertion or update operation. The common prompt message for this kind of error is: Datatoolongforcolumn'column_name'. it tells us a certain field

Can't connect to local MySQL server through socket 'socket_name' (2) - How to solve the MySQL error: Can't connect to the local MySQL server through socket (2) Can't connect to local MySQL server through socket 'socket_name' (2) - How to solve the MySQL error: Can't connect to the local MySQL server through socket (2) Oct 05, 2023 am 09:18 AM

Can'tconnecttolocalMySQLserverthroughsocket'socket_name'(2)-How to solve MySQL error: Unable to connect to the local MySQL server through socket (2), specific code examples are needed When developing and managing MySQL databases, sometimes we encounter some problems, One of the common problems is the inability to connect to the local MySQL server via socket. when we taste

Duplicate entry 'value' for key 'unique_key_constraint' - How to solve MySQL error: Duplicate records in unique key constraints Duplicate entry 'value' for key 'unique_key_constraint' - How to solve MySQL error: Duplicate records in unique key constraints Oct 05, 2023 am 09:57 AM

How to solve the MySQL error: Duplicate records in unique key constraints, specific code examples are needed. When using the MySQL database, we often encounter an error, that is, the error: "Duplicateentry'value'forkey'unique_key_constraint'". This error is usually caused by a unique key constraint being violated when inserting or updating data, resulting in duplicate records in the database. Unique key constraints can ensure that a certain field in the database

Unknown column type 'column_type' in column 'column_name' - How to solve MySQL error: Unknown column type in column Unknown column type 'column_type' in column 'column_name' - How to solve MySQL error: Unknown column type in column Oct 05, 2023 pm 02:28 PM

Title: How to solve MySQL error: Unknown column type in column, specific code example is required Introduction: Database plays an important role in the application development process, and MySQL, as one of the commonly used relational database management systems, is widely used In various web applications and enterprise-level systems. However, in the process of using MySQL to create tables, you sometimes encounter error messages. One of the common errors is "Unknowncolumntype'column_type'in

Unknown column 'column_name' in 'table_name' - How to solve MySQL error: unknown column name in table Unknown column 'column_name' in 'table_name' - How to solve MySQL error: unknown column name in table Oct 05, 2023 pm 02:18 PM

Unknowncolumn'column_name'in'table_name'-How to solve MySQL error: Unknown column name in table, specific code example is needed. When using MySQL database, sometimes you will encounter such error message: Unknowncolumn'column_name'in'table_name'(table Unknown column name in ). This error is usually caused by the specified column name not existing in the table. In this article

See all articles