Can't access MySQL databases after upgrade to Mountain Lion (using MAMP) - mysql

I recently upgraded to Mountain Lion from Snow Leopard, and in doing so threw my entire local development environment into disarray. I solved the majority of my issues by finally installing MAMP Pro (I was previously using the "native" methods provided by Apple). The problem I have now is I still can't access my old mysql databases. I can view the "new" databases via phpmyadmin in MAMP, but I have old projects that I'd like to work on.
My old databases still exist in /usr/local/mysql/data, but they don't appear in phpmyadmin or even if I query via Terminal (after logging in to mysql & using the show databases; command). I'm sure the answer involves just a few simple commands, but I'm mainly a front-end guy, and I can't for the life of me find the solution on the internets.
Thanks.
UPDATE:
Just a reference for anyone else who might have this issue (or something similar). In order to do the dump, I ended up having to turn off MAMP's instance of MySQL, and starting up the old version (through System Preferences). Otherwise I was getting 1049 errors ("unknown database"), I suppose since it was looking at the new databases instead? Really out of my element here, if you can't tell...
Either way, now it looks like it actually doesn't matter if the MAMP version is active or not. Maybe I just needed to restart all instances of MySQL? Seriously, no clue, but all is good now...

Try this in terminal to dump old databases (replacing [text]):
/usr/local/mysql/bin/mysqldump -u root -p[pass] [db] > [filename].sql
Once you have the sql file you can import it back in with PHPMyAdmin within MAMP.

Related

Connecting my MySQL databases to phpMyAdmin

I am running Mac OS 10.10.2. I have recently been educating myself about php and SQL in order to create an online database application for my employer. However, I have been unable to load up my MySQL databases in phpMyAdmin. I have tried following some advice from this forum, but no answers seem to solve my issue.
I installed MySQLWorkbench (Ver. 6.2.4.12437) as well as XAMPP (Ver. 5.6.3-0), and was using phpMyAdmin to have a play around and better understand what I was getting myself into. I then found one of those follow-the-bouncing-ball type teaching websites which advised me to download and install the MySQL community server (Currently running Ver. 5.6.23)
As instructed, I was learning SQL commands through Terminal and built up some databases/tables this way. I decided I wanted to jump into phpMyAdmin where I felt it'd be easier to continue my work. At first XAMPP was unable to turn on the servers which I overcame by uninstalling and reinstalling. Then I was getting a #2002 error when trying to access phpMyAdmin. I tinkered with config files and put in details relating to my localhost MySQL server (Or at least I assume as much).
I was able to get back into phpMyAdmin finally, but my databases made through terminal are not there.
phpMyAdmin shows: cdcol (the example database), information_schema, mysql, performance_schema, phpmyadmin, and test.
If I open terminal and punch in 'mysql' then 'SHOW DATABASES;' it only lists: information_schema.
If I open terminal and punch in 'mysql' with username 'root' and my password, then 'SHOW DATABASES;' it lists: information_schema, mysql, performance_schema, my tutorial/learning database, and my business database. I dropped the test database from here. THESE are what I want to bring up in phpMyAdmin.
I can only guess that I haven't got it configured properly to access this last mysql server, but I can't determine where I am going wrong. If anyone can shed some light on this, that'd be greatly appreciated.
It appears as if you have two MySQL instances; one from the XAMPP and also the MySQL Community Server that you installed yourself.
The "M" of XAMPP is for MySQL, so yes usually it runs its own MySQL server instance. That's sort of the point of the packaged kit, so you don't have to worry about having any of your own applications installed. In theory it should be no problem to stop the XAMPP MySQL instance and instead use your other one, but may require tweaking some configuration files and is probably not supported. If you can make it work, I don't see a reason why it would be a problem, though.
My suggestion is to either use the complete XAMPP stack or roll your own installation rather than mix and match.

Mysql database not showing up localhost phpmyadmin (sequel pro)

I'm doing some local wordpress development, I run everything directly from my machine (don't use MAMP or XAMPP). I'm at the place where I'm ready to take the site live - searching the internet it seems like the best way to extract the database is to use phpmyadmin. Locally, I use sequel pro to create and manage my databases. I just added phpmyadmin to my localhost and can see 2 of my databases, but not all. Does anyone know why that is? I'm sure there are other ways to accomplish what I'm trying to do (and I'm happy to hear them too) but also curious why some databases are showing up in phpmyadmin while others are not.
thanks :)
It's very likely that the user connecting through phpmyadmin just simply doesn't have the privileges to see the databases. I'm pretty sure (not 100%) that your path to 'go-live' is dump and restore from local to production and this can be achieved using mysqldump to create your backup file to permit you to copy all the local data into your live machine and restore it. I would assume that sequel pro also permits this activity through gui. If you want to do it like the DBAs do, lookup mysqldump in the MySQL documentation and work from the MySQL command line client. Good luck.

MySql move databases, new installation OSX Mavericks

Recently I made a clean install of OS X Mavericks, and right now i have setup ok mysql,phpmyadmin and apacheserver is running without problems.
PhpMyadmin as i was sure it will be, has no databases.
The databases are located in another disk installation from MountainLion that i was running before.
I understand that i can login PhpMyAdmin and export those databases in .sql one by one but there are a LOT,so i was wondering if there is a faster method to access the files and move to the Mavericks disk.
I remember in another installation i was digging around and i found those databases in the disk but my problem was that they were directories and not just .sql files to copy/paste, and i think that i had permissions problems
By that time they were not many so i prefered to use standard method, export from phpMyAdmin and then import again in the other OSX installation.
I have root access for sql.
Basically everything is the same/carbon as the old installation of MountainLion (username,password etc) so i was wondering if i can copy/paste somehow method.
If permissions needs to be set correctly please advise.
Try out MySQL Workbench for exporting and importing databases:
Workbench
Features
You can connect to one database and fetch data directly from another.
Allthough DannyThunder answer can help a lot other users (and i will choose it as correct) i will go with what most of the devs suggest, to use mysqldump. Problem was that i thought i will not have access to old sql that is why i had to copy/paste somehow the folders, i have backup allready and i am in mavericks and currently restoring.
Backup (from another OS,server etc): mysqldump -u username -p -–all-databases > file.sql
Restore (to the new OS,server) : mysql -u username -p < file.sql
The others have given several good alternatives (I tend to use mysqldump as well), but I'll just point out that phpMyAdmin has no problem exporting multiple databases. Not sure why you think you have to do them one-by-one, but from the main page click Export; by default all databases are selected, you can use the "Custom - display all possible options" radio button to select certain databases only.

Manually placing MySQL database files in the data folder - WAMP - XAMPP

I recently switched from using XAMPP to WAMP on my Windows 7 machine so I can do fast switching of PHP versions.
I completely uninstalled XAMPP, but first I backed up my htdocs, apache and mysql directories just in case.
After I installed WAMP and had everything up and running, I figured I could just drop some of my databases from my old XAMPP install into the "data" directory of the mysql directory in WAMP.
So that worked and the database shows up in phpMyadmin, but there are no tables. Is this a permissions thing? Like maybe I don't have the same user in the new install of mysql? Or am I missing something?
Am I allowed to just copy MySQL databases from one data folder to another or does it not work that way?
Both instances are using MySQL 5.5 (at least that's what both README files say in both MySQL directories).
THANKS
When using phpMyAdmin out of the box so to speak in WAMP, MYSQL is installed as per its default installation with the root userid setup to have NO PASSWORD.
Some people seem to think they should make one up when they see the login screen, is that what you are doing?
When you do this phpmyadmin allows you to APPEAR to login but then as you do not have root's privilages you see almost nothing on its other screens and are allowed to do nothing.
Use
username = root
password = (leave this blank)
Then set a password, there is a link on the next page it presents. AND DONT FORGET IT!!!!
This generally isn't a good idea. RiggsFolly was asking about your table type because some table types are more forgiving than others. Other possible trouble spots include file system permission problems or MySQL permission problems (as RiggsFolly asked).
I'd suggest to do an export (as an SQL file) and import that for a complete solution.

MySQL Server start permission denied

I am a a newbie to database programming and I want to try out MySQL.
I just installed MySQL from the official website, I am running mac 10.8.2.
Anyways, whenever I try to run a simple command like $>mysql.server start
it says Permission denied.
I am able to open it through sudo but I would love to get this fixed as this is annoying me, that it wont work properly. I have been searching for the last two hours without finding a fix, so I was hoping anyone could give me a helping hand.
The easiest way is to install the MySQL Startup Item. Then you get a Preference pane for MySQL.
See http://dev.mysql.com/doc/refman/5.5/en/macosx-installation-startupitem.html for full instructions.
Re your comment:
It's often required for services like mysql.server need to run as a uid other than your user login. For instance, the MySQL data directory may only be writeable by the mysql uid. So starting such a service must be done from a user that can change the uid of the process. The root uid can do that, so it's necessary to use sudo to launch service processes like mysql.server.
TL;DR: YOU HAVE TO USE SUDO.
If you a absolute newbie to MYSQL and you just want to use the MYSQL server to test your code on you local MAC I would advice you to take a look at XAMPP / MAMP. Xampp offers a complete out of the box install for everything you need for a development servers (Apache server, MySQL, PHP, etc). Note, that I XAMPP / MAMP is not suitable for production server setting.
I personally use the XAMPP Windows version. I haven't tried MAMP but I have come across it many times . The XAMPP for Mac version seem not to have been update for a while so I suggest you give MAMP a try.
You could of course try to get your current install to work but that might require some work. Also with regard to firewall / security issues. With the out of the box version you will have to do a lot less. Why reinvent the wheel if you can easily install a out of the box version.