Mac os install MySQL database, the system prompts Mysql:command not found what to do

Source: Internet
Author: User
Tags mysql in

After we have installed MySQL, enter the MySQL command at the terminal and find that we cannot see the database you installed because you do not have the environment variable configured.

installing MySQL database in OS system is saved by default in/usr/local/mysql

So how do we configure environment variables?

1, open terminal, enter: sudo su enter into the System Administrator management directory (of course you need to enter your user password to enter)

2. Input command:Vim/etc/profile then go to the vim editing interface

3, in the Vim editing interface, press I to enter the editing state, then, you can add the path name, enter the command: Export path= $PATH:/usr/local/mysql/bin

4. Press the ESC key to exit the edit state

5. Input command:: wq! (Means save and force exit)

6, then recalled my previous terminal interface:

7, in this interface and then enter the command: Source/etc/profile indicates that the setting takes effect immediately, of course, you shut down after the restart is the same reason

You can enter: MySQL return to test

What if the system still prompts Mysql:command not found?

1, Apple-and system preferences, the bottom point of MySQL in the pop-up page to close the MySQL service;

2. Enter Terminal input: Cd/usr/local/mysql/bin

3, enter after the login administrator permissions sudo su (input your computer password)

4, enter the following command to disable the MySQL authentication function./mysqld_safe--skip-grant-tables & (Note mysqld)

5. mysql will restart automatically after carriage return (you can see that the MySQL status will become running in the preferences)

6. Then enter the command./mysql

7, enter after you can see the following effect:

There is a comfortable mysql> prompt!!!

8, the following is the change password

Then enter:FLUSH privileges;

after entering the carriage, enter: SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' 123 ');

9. Re-open a terminal and enter: the mysql-uroot-p123 can enter MySQL data:

Ref: 54694230

Mac os install MySQL database, the system prompts Mysql:command not found what to do

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.