How do I find out where MySQL is installed on Mac OS X 10.7.9? I have MAMP installed so I presume that it is bundled with this install?
To check MySQL version of MAMP , use the following command in Terminal:
/Applications/MAMP/Library/bin/mysql --version
Assume you have started MAMP .
Example output:
./mysql Ver 14.14 Distrib 5.1.44, for apple-darwin8.11.1 (i386) using EditLine wrapper
UPDATE: Moreover, if you want to find where does mysql installed in system, use the following command:
type -a mysql
type -a is an equivalent of tclsh built-in command where in OS X bash shell. If MySQL is found, it will show :
mysql is /usr/bin/mysql
If not found, it will show:
-bash: type: mysql: not found
By default , MySQL is not installed in Mac OS X.
Sidenote: For XAMPP, the command should be:
/Applications/XAMPP/xamppfiles/bin/mysql --version
It will be found in /usr/local/mysql if you use the mysql binaries or dmg to install it on your system instead of using MAMP
If you run SHOW VARIABLES from a mysql console you can look for basedir.
When I run the following:
mysql> SHOW VARIABLES WHERE `Variable_name` = 'basedir';
on my system I get /usr/local/mysql as the Value returned.
(I am not using MAMP - I installed MySQL with homebrew.
mysqldon my machine is in /usr/local/mysql/bin so the basedir is where most everything will be installed to.
Also util:
mysql> SHOW VARIABLES WHERE `Variable_name` = 'datadir';
To find where the DBs are stored.
For more:
http://dev.mysql.com/doc/refman/5.0/en/show-variables.html
and
http://dev.mysql.com/doc/refman/5.0/en/server-options.html#option_mysqld_basedir
If you downloaded mySQL using a DMG (easiest way to download found here http://dev.mysql.com/downloads/mysql/) in Terminal try: cd /usr/local/
When you type ls you should see mysql-YOUR-VERSION. You will also see mysql which is the installation directory.
Source: http://geeksww.com/tutorials/database_management_systems/mysql/installation/how_to_download_and_install_mysql_on_mac_os_x.php
If you've installed with the dmg, you can also go to the Mac "System Preferences" menu, click on "MySql" and then on the configuration tab to see the location of all MySql directories.
Reference: https://dev.mysql.com/doc/refman/8.0/en/osx-installation-prefpane.html
for me it was installed in /usr/local/opt
The command I used for installation is brew install mysql#5.6
Or use good old "find". For example in order to look for old mysql v5.7:
cd /
find . type -d -name "mysql#5.7"
For me I was able to get the location at the path "/opt/homebrew/etc"
I have installed mysql using homebrew.
If you are not able to get the exact path start the mysql server -> mysql.server start
then run mysql -v to check the version, it will bring you in to the mysql.
run SHOW VARIABLES WHERE Variable_name = 'basedir'.
Navigate to path "/opt/homebrew/etc"
Related
I ran sudo apt-get install mysql-client and it installed correctly. Then I ran mysql_config_editor print and I got
mysql_config_editor: not found
mysql_config_editor does not show up in /usr/bin like I expect it to, and like it does on my other machine.
On the machine where it worked, mysql --version shows
mysql Ver 8.0.21-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))
On the machine where it doesn't work, mysql --version shows
mysql Ver 15.1 Distrib 10.1.45-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
How can I install a version of mysql that comes with mysql_config_editor or install the mysql_config_editor utility itself?
On MariaDB, as we have not a utility like mysql_config_editor to create ~/.login.cnf with obfuscated passwords, neither MariaDB reads it, one could degrade to ~/.my.cnf file with plain text:
[client]
user=my_username
password=my_password
#port=mysql_port
#socket=my_socket
#database=my_default_dbname
And then change access modes:
chmod 600 ~/.my.conf
Now only you can read this plain text file.
This avoids you to type user and password on command line on debian os in an insecure way, readeable by ps command.
mysql
Ref. https://mariadb.com/kb/en/configuring-mariadb-with-option-files/
Unfortunately MariaDB does not support this feature as explained here : https://mariadb.com/kb/en/mysql_config_editor-compatibility/
MariaDB is a fork of MySQL. So you can use its client to connect to a MySQL DB but it lacks the mysql_config_editor option.
Installing a MySQL client with mysql_config_editor is covered here : https://askubuntu.com/a/708606/943405
But I strongly advice you to uninstall the MariaDB client before and reinstall the full MySQL client to avoid troubles.
If you can't uninstall the MariaDB client then your solution is the best.
I Downloaded MySQL 5.7.10 to my Mac El Capitan 10.11.2 and installed, then started MySQL from Preferences. Then I ran "cd /usr/local/mysql/bin/". Then when I do "ls" I see "mysql". So all looks installed correctly.
I am now following the MySQL tutorial to start a database instance (ultimately I want to run some CREATE TABLE scripts). But, "user$ mysql -u root" gives me -bash: mysql: command not found" .
My final goal is to do my SQL commands against a MySQL instances using an IDE like MySQL Workbench or Jetbrains Datagrip. But I am stumped.
I do not get "mysql> "
Try /usr/local/mysql/bin/mysql -u root. If that works, then you need to alter your $PATH environment variable to include /usr/local/mysql/bin.
I am new to both linux and also mysql but somehow by obtaining help from net I have installed mysql v5.5 on redhat. It starts fine, I have confirmed this by running command:
"/etc/init.d/mysqld status"
But I am not able to change password using command:
mysqladmin -u root password 'new-password'
It gives error : bash: mysqladmin: command not found.
I tried searching mysqladmin by using command "find / -name mysqladmin" but it returned no result
All I can search on net is adding to path '/bin:/usr/local/mysql/bin' but directory structure after installation mysql v5.5 has changed. There is no such directory like /usr/bin/local/mysql now.
please help me with how to run mysql after changing root's password.
first of all see what MySQL packages are installed
rpm -qa | grep -i mysql
Second, try using locate in order to find the tool path
BTW,
According to pbone mysqladmin is provided by mysql-client (rather than mysql) as it was on older cackeages
I just installed mysql with homebrew on mac OSX.
The very first thing I did after the installation was the following symlink:
/usr/bin/mysql -> /usr/local/Cellar/mysql/5.5.15/bin/mysql
But if I type 'mysql', instead of having the mysql-client interface, I get into /var/empty/, exactly like if I was doing a cd /var/empty/
Why, and how can I fix this problem so that the mysql command execute the mysql client ?
This can occur if you're using zsh since it will drop you into a user's home directory just by typing their user name. So if mysql isn't in your path (which it wouldn't be since it's a keg only formula), but you have a mysql user, then this is the behavior you would see. You can force Homebrew to link mysql into your path with brew link --force mysql55.
Does your shell have a 'mysql' alias, perhaps, which is malfunctioning? alias at the prompt will show any aliases that are set.
For Homebrew 3.2:
brew link mysql#5.7 --force
Of course if the installed version was 5.7.
i cannot get mysql workbench 5.2 to work. i have mamp and mamp pro installed and running and no matter what type of connection i try it just wont connect. what can i do?
i have a mac with snow leopard
In MySQL workbench use Connection Method: Local Connection/Pipe and in the setting Socket/Pipe path enter: /Applications/MAMP/tmp/mysql/mysql.sock then enter your root username/password.
There are two tasks that need to be fixed to get MySQL Workbench working with a MAMP installation:
1) The Start/Stop/Status commands for the MySql server need to changed from the Server Instance configuration to the following:
Set the Start MySQL command to:
/Applications/MAMP/bin/startMysql.sh
Set the Stop MySQL command to:
/Applications/MAMP/bin/startMysql.sh
Set the Check MySQL Status command to:
ps xa | grep "/Applications/MAMP/Library/bin/[m]ysqld"
2) The my.cnf file needs to be created manually and the appropriate permissions given through a terminal window:
Utilities -> Terminal
sudo touch /etc/my.cnf
sudo chown joeb /etc/my.cnf
Changed joeb with your username.
If you want a more detailed guide, see MAMP, MySQL Workbench, WordPress installation and setup guide for MAC.
I follwed these instructions and got it to work: http://chrischarlton.us/tip/using-mysql-workbench-mamp-pro