Home > Database > Mysql Tutorial > How to install mysql with brew

How to install mysql with brew

藏色散人
Release: 2021-12-01 15:47:04
Original
3850 people have browsed it

How to install mysql with brew: 1. Execute the "brew install mysql@5.7" command; 2. Start mysql; 3. Log in to mysql and change the default password.

How to install mysql with brew

The operating environment of this article: macOS10.15 system, mysql5.7 version, macbook pro 2020 computer.

How to install mysql with brew?

Mac uses brew to install mysql

If you do not consider the version, directly execute the following command

brew install mysql
Copy after login

If you want to select a version, just add @version, for example

brew install mysql@5.7
Copy after login

Start mysql after installation

mysql.server start
Copy after login

If the service is not started, the following error will occur

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Copy after login

To close mysql

mysql.server stop
Copy after login

If you see the success prompt, it means the startup is successful

Starting MySQL
. SUCCESS!
Copy after login

Now log in to mysql, which is password-free by default

mysql -u root
Copy after login

Change the root password, This is the modification method for 8.0

alter user 'root'@'localhost' identified with mysql_native_password by 'root';
Copy after login

If there is a prompt after pressing Enter, it means the modification is successful

Query OK, 0 rows affected (0.00 sec)
Copy after login

Then exit mysql

exit;
Copy after login

Finally log in again

mysql -u root -p
Copy after login

If you enter the password, you will be logged in successfully

[Related recommendations: mysql video tutorial]

The above is the detailed content of How to install mysql with brew. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template