Using MySQL on OS X Yosemite with XAMPP

Not working MySQL after installing XAMPP on OS X ???


If answer is YES, You've come to the right place :)

After installing XAMPP on OS X go to the launchpad click XAMPP (Other) and
open manager-osx app. This is the XAMPP control panel






XAMPP control panel


After that click Application log tab and start Apache web server and MySQL server.







Now go to the terminal and type mysql and press enter. If terminal says that it doesn't know that command it because it doesn't know the path to the mysql directory.
To fix that problem you should give permissions to other things to access XAMPP directory onApplication folder.
Go to the Application folder in Finder and find the XAMPP folder, Then right click on and clickget info.
Click on the pad lock icon that is below the Get-Info window. Provide your credentials and giveeveryone read and write permissions.






Reasons to provide permissions to everyone for this folder is when you're developing you've to put your web server contents inside the htdocs folder inside the XAMPP directory. By default permissions it doesn't let other applications to access those necessary files in XAMPP directory.
Now go to the terminal and change directory to the following path and check whether mysql is working properly
path = /Application/XAMPP/bin







run mysql using ./mysql -u root ( This means log in to the MySQL using the root account ) by default root account doesn't have a password.
If it shows a mysql> like in the screen shot above you've successfully logged in to the MySQL database server.
Whenever you want to log in to the MySQL database server it's really a pain to going to theXAMPP bin directory all the time.
For fix this issue open the .bash_profile file in Home directory using the Nano or Vim editor from your terminal.




use cd ~ command to go to the Home directory if you're not already in Home directory
nano .bash_profile will open .bash_profile file from built in nano editor

and add this ( export PATH="/Applications/XAMPP/xamppfiles/bin:$PATH" ) path end of that file and save using ( control+O ) and exit using ( control +X )





Now restart the terminal and try typing mysql -u root from anywhere. You can successfully log in to the MySQL server.



Success !!!


Happy Coding ...

Comments

Popular Posts