MAMP - Upgrade to MySQL 5.6 - mysql

Is it possible to upgrade the MAMP MySQL library to 5.6 ?
Or I'll need to install MySQL natively (Lion) ?
If someone could point me in the right direction...
Thanks!

The latest MAMP has MySQL 5.5.9. Given the occasional wonkiness of MAMP and general lack of support, I'd be hesitant to mess about with it internally to upgrade it.
However, there's nothing wrong with disabling the MySQL that comes with it, installing 5.6 separately, then pointing it at the MAMP MySQL data files. You'll need to remember to run the upgrade script that comes with MySQL, so probably best to take a copy of the MAMP data first and move it to the data folder of the new MySQL install.
The only reason to use MAMP in the first place is that messing about with the built in copy of Apache can make file sharing stop working, so it's easier to use MAMP instead on a different port, but this doesn't apply to MySQL so you should be OK.

It is possible. I have it running. Install MySQL
http://dev.mysql.com/downloads/mysql/
Download the Mac version
Then change your mysql.sock in MAMP to the new one
mv /Applications/MAMP/tmp/mysql/mysql.sock /Applications/MAMP/tmp/mysql/mysql.sock.back
ln -s /var/mysql/mysql.sock /Applications/MAMP/tmp/mysql/mysql.sock
Restart MAMP

Found a solution on gist and modified it a bit:
#!/bin/sh
wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.22-osx10.9-x86_64.tar.gz
tar xfvz mysql-5.6*
rm mysql-5.6.22-osx10.9-x86_64.tar.gz
echo "stopping mamp"
sudo /Applications/MAMP/bin/stop.sh
sudo killall httpd mysqld
echo "creating backup"
sudo rsync -a /Applications/MAMP ~/Desktop/MAMP-Backup
echo "copy bin"
sudo rsync -av mysql-5.6.*/bin/* /Applications/MAMP/Library/bin/ --exclude=mysqld_multi --exclude=mysqld_safe
echo "copy share"
sudo rsync -av mysql-5.6.*/share/* /Applications/MAMP/Library/share/
echo "fixing access (workaround)"
sudo chmod -R o+rw /Applications/MAMP/db/mysql/
sudo chmod -R o+rw /Applications/MAMP/tmp/mysql/
echo "starting mamp"
sudo /Applications/MAMP/bin/start.sh
echo "migrate to new version"
/Applications/MAMP/Library/bin/mysql_upgrade -u root --password=root -h 127.0.0.1
https://gist.github.com/tobi-pb/b9426db51f262d88515c
If everything worked, you have to delete the mySQL backup on your desktop. You can check the current mySQL-Version by executing the following command on your local server:
SHOW VARIABLES LIKE "%version%"

Download the official script by MAMP to update your MySQL to 5.6.12
http://blog-en.mamp.info/2015/07/how-to-use-mysql-5-6-with-mamp-and-mamp.html
For those of you who absolutely require MySQL 5.6 to be part of their development environment - maybe you are a Magento developer - we have released a shell script that updates the MySQL component of MAMP and MAMP PRO to v5.6. The script requires at least MAMP and MAMP PRO 3.3, older versions are untested.

Since MAMP 4.x is released, just use that version / upgrade your existing MAMP installation. MySQL 5.6 is already included.

Related

MAMP server : start and stop server [duplicate]

I am trying to find a way by which I can start and stop MAMP PRO's Apache and mysql using command line.
So far whatever I have search has only helped me start MAMP PRO.
Thanks.
As of at least MAMP 3.0.6, the following works for both Free and Pro versions:
Open MAMP Pro or Free, depending on the one you use:
Pro:
open /Applications/MAMP\ PRO/MAMP\ PRO.app/
Free:
open /Applications/MAMP/MAMP.app/
Then, cd into MAMP/bin:
cd /Applications/MAMP/bin
To start Apache & MySQL:
./start.sh
To stop Apache & MySQL:
./stop.sh
Note that you might need to sudo the commands above.
After much trial and error:
Note that I have my ports set to the application's respective defaults (Apache: 80, MySQL: 3306), and as such these commands reflect that, AND you must use sudo with Apache (which you will in MAMP as well if you're using port 80).
Apache
sudo /Applications/MAMP/Library/bin/httpd -f "/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k start
sudo /Applications/MAMP/Library/bin/httpd -f "/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k stop
sudo /Applications/MAMP/Library/bin/httpd -f "/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k restart
MySQL
To start MySQL:
sh -c '/Applications/MAMP/Library/bin/mysqld_safe --defaults-file=/Applications/MAMP/tmp/mysql/my.cnf --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --user=alex --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log.err --tmpdir=/Applications/MAMP/tmp/mysql/tmpdir --datadir=/Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql &'
(for some reason you must hit enter again to regain your prompt)
To stop MySQL:
sh -c '/Applications/MAMP/Library/bin/mysqladmin -u root -proot --socket=/Applications/MAMP/tmp/mysql/mysql.sock shutdown'
As a bonus, the indicators in the MAMP PRO.app GUI show the correct status of these apps in real time, so you can continue to rely on that.
I have MAMP PRO v2.0.3.
http://pastebin.com/avn0BFap
Save the script and give executable rights such as: chmod +x start.sh
Then use it like ./start.sh Start or ./start.sh Stop or ./start.sh Restart
Best Solution for MAMP 3 on OSX
(should work for MAMP Pro as well).
Look inside of the folder:
/Applications/MAMP/Library/bin
You'll see the scripts used for starting and stoping Apache & MySQL.
Look inside any of the scripts:
start.sh or stop.sh or startApache.sh etc
You will see that they use the program:
apachectl
You can use the restart command with apachectl. So, just set-up an alias in your ~/.bash_rc file:
alias rap='sudo /Applications/MAMP/Library/bin/apachectl restart'
rap is the acronym I gave for 'Restart Apache'. Presto! One step from the command line without having to open the MAMP application. Use the same logic if you want to set this up for MySQL.
To start it on MAMP pro version 4 it's
/Applications/MAMP\ PRO/MAMP\ PRO.app/Contents/MacOS/MAMP\ PRO cmd startServers
To stop it it's
/Applications/MAMP\ PRO/MAMP\ PRO.app/Contents/MacOS/MAMP\ PRO cmd stopServers
Sadly
Based on the advice given here
"https://deliciousbrains.com/automating-local-wordpress-site-setup-scripts-part-3-automating-rest"
And found then discovered - it's HIDDEN in the documentation right here.
https://documentation.mamp.info/en/MAMP-PRO-Mac/How-Tos/General/CreateHostDatabaseCommandLine
Nearly the same with MAMP Pro 5:
/Applications/MAMP\ PRO.app/Contents/MacOS/MAMP\ PRO cmd stopServers
start:
/Applications/MAMP\ PRO.app/Contents/MacOS/MAMP\ PRO cmd startServers
If you are using MAMP PRO there is an easier way to stop MySQL.
MAMP PRO creates a shell script in your Library folder. If you've changed the password for the root user (which you should), the updated password will also be reflected in the script. The file can be found at:
~/Library/Application Support/appsolute/MAMP PRO/stopMysql.sh
In order to type that on the command line you need to escape the spaces by adding a backslash in front of them like the command below.
Stop MySQL Shell Script for MAMP PRO
~/Library/Application\ Support/appsolute/MAMP\ PRO/stopMysql.sh
The other thing that I found on my system was that the file didn't have the execute bit set on it. I cheated and used Path Finder to set the file as executable but you can easily find information about how to do it through the command line with chmod.
Unfortunately I can't find a proper start script created by MAMP PRO. I wanted to find something simple to use for the start command in MySQLWorkbench but for now I just left it blank because the default MAMP script does not work. I may create a script based on the helpful commands Astockwell posted in response to this question.
I found /Applications/MAMP PRO/MAMP PRO.app/Contents/Resources/MAMP.startup, which works for me in MAMP PRO, with custom ports.
Just run
/Applications/MAMP PRO/MAMP PRO.app/Contents/Resources/MAMP.startup start
or
/Applications/MAMP PRO/MAMP PRO.app/Contents/Resources/MAMP.startup stop
etc.
Simple way would be to shut down and restart the application, MAMP PRO will start and stop Apache and MySQL.
start MAMP PRO
open -a MAMP\ PRO
stop MAMP PRO
osascript -e 'quit app "MAMP PRO"'
For MAMP Pro 5 use
sudo /Applications/MAMP/Library/bin/apachectl -f"/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k restart
remember, you must use sudo
For MAMP5.5, search for this script file in your MAMP bin folder: startMysql.sh
It would have few lines:
#!/bin/sh
/Applications/MAMP/Library/bin/mysqld_safe --port=8889
--socket=/Applications/MAMP/tmp/mysql/mysql.sock --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log &
Copy Paste the entire command on your OSX shell and just press enter, your Mysql server would start.
Open a new shell and start using Mysql from command line.

MySQL Start Error

I am trying to install MySQL 5.6.17 on Ubuntu Linux and I am having difficulties doing so. I opened the MySQL Reference and opened "Installing MySQL on Unix/Linux Using Generic Binaries". I followed the following step:
shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql &
//Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server
After that when I try to start MySQL using /etc/init.d/mysql.server start I get the following error:
Couldn't find MySQL server (/usr/bin/mysqld_safe)
I looked in /usr/bin and I found mysqld_safe. Any suggestions on how to fix that problem. Please reply with a detailed solution.
Thank You
It seems you have installed Mysql in "/usr/local" and init script is looking for binaries in "/usr"
Change the "basedir" in /etc/init.d/mysql.server to :
basedir=/usr/local
The fact that you found /usr/bin/mysqld_safe suggests that MySQL in some shape or form was preinstalled on your OS. This can cause some confusion, in particular due to location of config files.
So for instance, on some versions of Ubuntu, the packages mysql-common is pre-installed, which means you might have an /etc/mysql/my.conf file with some defaults in it. When you install from the tar file to /usr/local, follow the INSTALL-BINARIES (or equivalent) instructions, and try to start /etc/init.d/mysql.server start you might get errors as the one you report ("Couldn't find MySQL server (/usr/bin/mysqld_safe)"), because the default configuration in /etc/init.d/mysql.server and any /etc/my.cnf that you created (optional step during install) is getting over-ridden by a setting in the OS installed /etc/mysql/my.conf. Note that this might happen even if you change the values in /etc/init.d/mysql.server and/or /etc/my.cnf.
One way out is to merge /etc/my.cnf and /etc/mysql/my.cnf into a single file at one of these locations, with the correct defaults that you wish to use.

How do I update phpMyAdmin in Ubuntu?

I have an old phpMyAdmin installation (contains my training and jobs data). I want to update it to the latest version and I want to keep my data safe while updating it. Is there any way to do it by running some commands on the terminal? Is my data erased if I uninstall phpMyAdmin?
Here is how to upgrade/downgrade on Ubuntu.
Note: The following instruction only works if you previously (and correctly) installed phpMyAdmin with the command line and use APACHE as a web server.
I suppose that you already have a working phpMyAdmin, but the version isn't the one you want. For instance, Ubuntu is shipping the 4.6.x version which doesn't work properly with PHP 7.2.
Check the version you want on:
https://www.phpmyadmin.net/files/
On your server
cd /usr/share/
rm -rf phpmyadmin
then adapt this line with the correct version number
wget https://files.phpmyadmin.net/phpMyAdmin/4.8.0/phpMyAdmin-4.8.0-all-languages.zip
unzip phpMyAdmin-4.8.0-all-languages.zip
rm phpMyAdmin-4.8.0-all-languages.zip
mv phpMyAdmin-4.8.0-all-languages phpmyadmin
Note: If unzip don't work, install it with: sudo apt-get install unzip
Check permissions
Now you should be good.
The owner of /usr/share/phpmyadmin should be root:root on a default installation. This should be fine but if you face some permissions issues, you can try to let Apache be the owner:
# only if you have permissions issues
chown -R www-data:www-data /usr/share/phpmyadmin
chmod -R 755 /usr/share/phpmyadmin
You can also restart Apache
sudo service apache2 reload
Troubleshooting
Note: Depending on your PHP version, you may need to install additional libraries.
For example, to resolve the error about missing mysqli and mysql extensions (update the command to reflect your PHP version):
sudo apt-get install php5.6-mysql
phpmyadmin is mysql client, so it will not affect your database if you uninstall phpmyadmin.
I update phpmyadmin by using terminal commands:
First you have to add repository to get phpmyadmin :
sudo add-apt-repository ppa:nijel/phpmyadmin;
and then update it to get the latest version of software in repositories :
sudo apt-get update;
after that, you can get it (install, you need to uninstall the older version first if you have) :
sudo apt-get install phpmyadmin;
Oh, make sure you are connected to the internet
Using ubuntu? i think it will be better if you ask it in ubuntu forum.
may it helps
------ UPDATE -------
If you find the phpmyadmin version you get from ppa is not the latest one, you can find the latest version here and install it manually (not from repo).
Downloaded phpmyadmin can be installed in /var/www/html/ or in your working directory (public_html or something you've defined). Just extract the zip and move extracted folder to /var/www/html/. And don't forget to change the permission of the phpmyadmin folder to 777(it may not safe, but works fine).
Here is the how:
extract downloaded file
unzip phpMyAdmin-4.6.6-all-languages.zip
move to /var/www/html/, you might need sudo.
if you're not sudoer, move it into your working directory (e.g. public_html), and rename the folder to 'phpmyadmin'
sudo mv phpMyAdmin-4.6.6-all-languages /var/www/html/phpmyadmin
change the permission
sudo chmod 777 -R /var/www/html/phpmyadmin
and then you can access phpmyadmin via http://localhost/phpmyadmin.
If you put the phpmyadmin in public_html, you might want to create a symlink into it from /var/www/html, so you can access phpmyadmin as usual.
phpMyAdmin is only client for MySQL database, it doesn't contain your data. It's all saved in database, so nothing will be deleted even if you delete phpMyAdmin.
To update phpMyAdmin from repository you can follow steps from this thread.
1- check your phpmyadmin version from GUI.
2- Download Latest version of phpMyAdmin HERE
Use the below command to download the latest version of phpMyAdmin into /opt or /usr/src directory
# wget https://files.phpmyadmin.net/phpMyAdmin/4.8.3/phpMyAdmin-4.8.3-all-languages.zip
Notes to install unzip package: apt-get install unzip
# unzip phpMyAdmin-4.8.3-all-languages.zip
3- Find phpMyAdmin Installation Directory
Use the below command to search the phpMyAdmin Installation Directory on your system
# /usr/share/phpMyAdmin
4- Remove/Delete phpMyAdmin content
/usr/share/phpmyadmin is correct phpMyAdmin installation directory, Just Delete/Remove everything from that directory
# cd /usr/share/phpMyAdmin/
# rm -Rf *
5- Move/Copy New phpMyAdmin content
Use the below command to copy all the new phpMyAdmin content to /usr/share/phpmyadmin.
# cd /opt/phpMyAdmin-4.8.3-all-languages
# mv * /usr/share/phpMyAdmin/
6- Restart Apache, MySQL or MariaDB service.
Start/Restart the service in SysVinit Systeme
# service restart httpd
# service restart mysql
Start/Restart the service in Systemd Systeme
# systemctl restart httpd.service
# systemctl restart mariadb.service
7- Now Check New version of phpMyAdmin
Navigate your browser to http://localhost/phpmyadmin, Now you are using latest version 4.8.3 of phpMyAdmin.
Reference
sudo su
cd /usr/share/
rm -rf phpmyadmin
wget https://files.phpmyadmin.net/phpMyAdmin/4.8.4/phpMyAdmin-4.8.4-all-languages.zip
unzip phpMyAdmin-4.8.4-all-languages.zip
mv phpMyAdmin-4.8.4-all-languages phpmyadmin
chown -R www-data:www-data /usr/share/phpmyadmin
chmod -R 755 /usr/share/phpmyadmin
sudo service apache2 reload

Lost or corrupt mysql table after computer is turned off or restarted

I'm using a mysql local database to store some data from two ruby scripts i created. The problem is that whenever I restart or turn off my computer my database seems to get corrupted as when i tried to access it it show the following error:
Can't connect to MySQL server on 'Andres-MacBook-Air-3.local' (61) (Mysql2::Error)
I then use the following commands (which I found while googling around) to restore the connection:
cd /usr/local/mysql
sudo ./bin/mysqld_safe
(Enter your password, if necessary)
(Press Control-Z)
bg
After I do that, I can connect to the database but when I try to access a table the following error comes up:
Error retrieving table information
An error occurred while retrieving the information for table 'fourCheckins'. Please try again.
MySQL said: Table 'trackpuntos.fourcheckins' doesn't exist
I think that turning off/restarting my computer is causing the problem as this same scenario has happen to be twice. Fortunately after the first time I am doing regular mysqldumps.
Does anyone have an idea on why is this happening/how to prevent it?
I'm running mysql 5.6.12, on a macbook air running OS Lion.
Thanks
I've been having the same problem for the past week. I'm finding the InnoDB databases are getting corrupted when I have open connections to the databases and I shut off/restart the computer.
I had installed mysql 5.6 unintentionally via homebrew upgrade on my Mac. I just rolled mysql back to 5.5.29 following the instructions below. After the downgrade back to 5.5, I set up my databases again, opened a bunch of connections, and then shutdown the computer. Upon reboot, I had no corruptions. Hopefully it'll stay that way!
Note: paths may be different for your system
Uninstall 5.6 mysql via homebrew
$ brew uninstall mysql
$ rm -rf /usr/local/var/mysql
Install 5.5.29 mysql via homebrew
$ cd /usr/local/Library/Formula
$ git checkout -b mysql-5.5.29 336c97637c5449018cde59f7d2a87a298692da08
$ brew install mysql
follow all the post-install steps for mysql...
$ unset TMPDIR
$ mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
reset homebrew to master !important!
$ git checkout master
Lastly, don't brew upgrade mysql until 5.6 is more stable!
I had the same problem after a reboot... Just stopped and restarted MySQL and my DB was working fine after that.

Restore Databases from Phpymyadmin

I test Drupal websites on my site locally on Mac using Phpmyadmin.
I recently had to to do a clean reinstall of my Mac. I have a full back up of my hardrive, but I'm not sure where to locate the databases in the back up and how to restore them.
Where does Phpmyadmin store the databases?
/usr/local/mysql/data
try it here
phpMyAdmin does not write any database files. It is a php client application which accesses a MySQL server.
On OSX the MySQL server creates its data files in /usr/local/mysql/data as far as I know.
1. Stop your MySQL server
sudo /usr/local/bin/mysql.server stop
2. Remove new data files
sudo mv /usr/local/mysql/data /usr/local/mysql/data.new
3. Copy old data files from your backup and fix prrmissions
sudo chown -R _mysql:wheel /usr/local/mysql/data
4. Start your server again
sudo /usr/local/bin/mysql.server start
5. Check and optimize databases
sudo /usr/local/mysql/bin/mysqlcheck --all-databases
Now phpMyAdmin will show all old databases