MySQL performs two methods of cannot found Mac installation MySQL (with configuration)

Source: Internet
Author: User

Two ways to install MySQL on Mac (with configuration

At this point we enter the mysql-uroot-p command at the command line to prompt for no commod not found, and we also need to add MySQL to the system environment variable.

(1).进入/usr/local/mysql/bin,查看此目录下是否有mysql,见pic6。(2).执行vim ~/.bash_profile    在该文件中添加mysql/bin的目录,见pic7:    PATH=$PATH:/usr/local/mysql/bin添加完成后,按esc,然后输入wq保存。最后在命令行输入source ~/.bash_profile
Webcoder2016.02.19 11:12 words 731 read 105073 comments 161 appreciate 2

Because before the development of the back-end, thinking, "Although now do the front-end, but can not forget the previous old bank, can be used to do the back end when the knowledge learned." We are going to start with the local database, the following main introduction of 2 installation methods and subsequent configuration, we hope to help. (Recommended installation package)

1. Install MySQL using the installation package (online download is too slow, need to install the package can leave a message at the bottom of the article, I sent you)
    • Double-click to open the installation file

Pic1.png
    • Double-click Pkg file Installation

Pic2.png
    • All the way down, remember to save the last pop-up box password (it's your MySQL root account password)

Mysql2.png
    • Under normal circumstances, the installation is successful.
    • The installation is successful, but additional configuration is required:

      (1) Enter System Preferences


Pic3.png

(2) Click MySQL


Pic4.png


(3) Turn on MySQL service


Pic5.png
    • At this point we enter the mysql-uroot-p command at the command line to prompt for no commod not found, and we also need to add MySQL to the system environment variable.
      (1).进入/usr/local/mysql/bin,查看此目录下是否有mysql,见pic6。(2).执行vim ~/.bash_profile    在该文件中添加mysql/bin的目录,见pic7:    PATH=$PATH:/usr/local/mysql/bin添加完成后,按esc,然后输入wq保存。最后在命令行输入source ~/.bash_profile


      Pic6.png

Pic7.png
    • Now you can login MySQL through mysql-uroot-p, will let you enter the password, is pic3 on the >fj ...
      After the login is successful, you can change the password by following the command
      SET PASSWORD FOR ‘root‘@‘localhost‘ = PASSWORD(‘newpass‘);
2. Installing MySQL with homebrew and the problems encountered
  • Installation commands

    brew install mysql
  • After the installation is complete, the local command line enters the MySQL command and finds no such command

    commond not found
  • First, check that you have installed the

    重新执行一遍 brew install mysql命令行提示:Warning: mysql-5.7.10 already installed, it‘s just not linked
  • Then find the solution online, and the final solution is to execute:

    brew link --overwrite mysql
  • But the execution, but the error

    Linking /usr/local/Cellar/mysql/5.7.10... Error: Could not symlink share/man/man8/mysqld.8/usr/local/share/man/man8 is not writable.
  • And on the Internet to find solutions, the last local experiment the following statement execution success

    sudo chown -R ‘yin‘ /usr/local注意: yin是你电脑的用户名
  • After resolving the problem, re-execute:

    brew link --overwrite mysql提示:Linking /usr/local/Cellar/mysql/5.7.10... 92 symlinks created

    Thought, this is a success. Re-execute:

    mysql -u root -p

    But also error:

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

    Execute in turn:

    unset TMPDIR
    bash mysql_install_db --verbose --user=root--basedir="$(brew --prefix mysql)"--datadir=/usr/local/var/mysql --tmpdir=/tmp
    接下来启动mysqlbash mysql.server start
Here, the installation of MySQL is over, I recommend the first installation package in the form of installation. Thank you ~

MySQL performs two methods of cannot found Mac installation MySQL (with configuration)

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.