Mac system MySQL Configuration environment variables

Source: Internet
Author: User
Tags mysql client

Mac first install MySQL, input mysql-u root-p will appear: Zsh:command not found:mysql prompt. The environment variables need to be configured at this time.

Mac version of MySQL client: mysql-5.6.24-osx10.9-x86_64.dmg

The first thing to know is what kind of shell you use for Mac OS x, using commands

Echo $SHELL

If the output is: CSH or TCSH, then you are using C Shell.

If the output is: bash,sh,zsh, then your use may be a variant of the Bourne shell.

Before Mac OS X 10.2, the default is C Shell.

The default is Bourne Shell after Mac OS X 10.3.

Open terminal, input: cd ~

Will enter the ~ folder

Then type: sudo vim. bash_profile

Enter the root user password to execute. sudo uses the root user to modify the environment variable file.

Enter at the bottom of the document: Export Path=${path}:/usr/local/mysql/bin

Then ESC exits the insert state and enters at the bottom: Wq save to exit.

Input: source. bash_profile

Enter execution, run environment variable.

Then enter MySQL and you can use it.

I found out after the test, the above practice every time you turn off the terminal in the open need to re-source. Bash_profile. So VI ~/.ZSHRC, added here:

Export Path=${path}:/usr/local/mysql/bin

After saving source ~/.ZSHRC

Then you can do it once and for all.

Mac system MySQL Configuration environment variable (RPM)

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.