Wednesday, 23 August 2017

macos - Unable to start MySQL from the terminal



I am quite new to the Macintosh, I have Mac OS 10.6 installed.



I downloaded the mysql-5.4.3-beta-osx10.5-x86.dmg file and installed all the files properly.




I have got MySQL server started in system preferences.



Now I want to access MySQL from the terminal but I am unable to do it.



I have tried mysql -u root.



It shows "-bash: mysql: command not found".



How can I make it work?




Is there any tool like phpMyAdmin for Mac?


Answer



It sounds like you have a path problem in the current shell. Some steps to check/do are:




  • Can you get to the MySQL prompt from the installed location ? Let's assume that you have installed MySQL in /usr/local/mysql. Then if you change directory (cd /usr/local/mysql/bin) you should be able to execute the mysql command: ./mysql


  • Check the path settings via env command in your current shell. What you are looking for is the value of PATH where you want to have something along the lines of:
    PATH=/usr/local/bin:/bin:/usr/bin:/usr/sbin..... with some reference to mysql's installled path


  • Reset your current path to include /usr/local/bin. This can be done in the instance of the current shell via export PATH=/usr/local/mysql/bin:/usr/local/bin:$PATH


  • Test that you can then access the mysql binary from any path on your system.





In terms of the tools for accessing MySQL you can take a look at:
- SequelPro
- MySQL Tools


No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...