How do I put a database onto a local server? - mysql

I have a bunch of backed up wordpress mysql database files, I am trying to access them in Microsoft Webmatrix. I originally used WAMP. I honestly have no idea what I'm doing. I am under the impression I have to have the database running on a server in order to connect to it? Help please...

You'll want to have a MySQL server instance installed (this may already be the case), then you can simply restore those backups. This link will help you with syntax for restoring databases from .sql files http://webcheatsheet.com/sql/mysql_backup_restore.php
Depending on the version of MySQL you have installed, and the version of MySQL the databases were created with, you may have to upgrade the databases. More information can be found here: https://dev.mysql.com/doc/mysql-enterprise-backup/3.8/en/restore-upgrade.html

Related

databases not visible in mysql workbench sidebar

It started with installation of wampserver for php, before that I had already running MySQL server 5.7 with all databases properly showing in the side schema panel. When I launched MySQL server after installation of wampserver 5.7.14, the password for root was overridden and no database except sys is showing. Also I found another user (mysql.sys) has been created (found in Users and Privileges). Then I looked for databases in path "ProgramData\MySQL\MySQL Server 5.7\Data", all databases are present in the folder (thank god they are not deleted). Problem is now for my website I get this error:
"Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration"
Exception Details: System.Data.Entity.Migrations.Infrastructure.AutomaticMigrationsDisabledException: Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration.
I know this is not related to migrations because my database already exists but I don't know how to solve the problem that MySQL can see the databases in its "ProgramData\MySQL\MySQL Server 5.7\Data" again.
When you installed WAMPServer on a system that already had a MYSQL Server instance installed on it, you created a second MySQL Server instance. See your service you will have one called wampmysqld or wampmysqld64 and another called MYSQL.
Now, whichever service you start first will be the MySQL Server that Workbench, or anything else is talking to. And you will only see the databases that this MySQL Server instance knows about.
Correct Solution:
Stop WAMPServer
Start the MYSQL installed with Workbench
Backup all YOUR databases, NOT the ones created by MySQL like mysql, sys, information_schema, performance_schema
Stop this MYSQL Server.
Uninstall this MySQL Server
Start WAMPServer
Restore your databases to this MySQL Server instance
All should start working as expected now.
Connect your Workbench to WAMPServers MySQL Server
Update
Did a robust workaround, though not very suggestible but database is now accessible in MySQL workbench. Though I'm having the same error when opening the website on local web server. One thing that I did not mention before that environment is Windows based. what I did is copied database from the ProgramData MySQL path to "..\wamp64\bin\mysql\mysql5.7.14\data" path and refreshed schema in workbench. Any advice why I'm still having problem in web server.

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 - Connect MYSQL Workbench to a MYSQL server on localhost

I know the question I am about to ask is a very stupid once but I am new to MYSQL so please bear with me. Want I want to do is create a database on my local machine and also access/manipulate it from their. I thought MYSQL WB was the all in one tool to do this i.e it will also allow me to create a database and also make a MYSQL server from which to access it. But I came to know the Workbench is just a front end and you need to have a some kind of a seperate MYSQL server module for it to access.
The problem is I can't seem to find any link for a simple a server module on the MYSQL download site.
http://dev.mysql.com/downloads/ .
It has one Cluster Server but I don't think this is what I am looking for. If anyone could provide a link to the MYSQL server module using which I could connect MYSQL Workbench on my local host, and the steps to connect them that would be great.
The one your looking for is named MySQL Community Edition. The current version is 5.6.14. Just select your platform (mac, linux or windows) and follow the installation guide.
If you wish to have php/mysql then you can download xampp. It includes all the necessary tools. Or if you wish to install it separately then follow this for Windows,
http://dev.mysql.com/downloads/installer/

inspect mySQL database

I have a mySQL database on my Windows PC. I'm pretty sure I've found the relevant files, namely the following:
formula.frm
formula.ibd
db.opt
What is the natural way to inspect, edit, and generally play with the contents of these files?
You do not view the binary database files directly. MySQL is a service that you connect to with a client and then perform SQL commands. You will need a client (such as MySQL Workbench) to work with the server.
MySQL Workbench is the GUI tool that allows you to connect to a MySQL database and perform actions on it including querying and creating/modifying the various parts of the database.
MySQL Workbench intro: http://dev.mysql.com/doc/workbench/en/wb-intro.html
Getting started with MySQL: http://dev.mysql.com/doc/refman/5.6/en/tutorial.html
There is also the command-line utility that is included when you install the server. It will be in the BIN folder of the MySQL install directory.
Command-line client info: http://dev.mysql.com/doc/refman/5.1/en/mysql.html
Use a tool like Mysql Workbench to connect to the DB. You do nothing directly to the files. You connect to the service and use the DB.
William, it sounds like your question is "how do I take mysql binary files and turn them into something usable on my machine?". If that's the case, you'll want to first install MySQL on your machine if you haven't already. Then you might have a look here for how to recreate a database from a .ibd file.

Can I find mysql version from data files, need for data restoration

I have a very odd situation going on here. I had a linux box running ubuntu 8.10 and MySQL server with a Wordpress installation on it hosting an internal blog for our company. The machine that this was running on has crapped out, but I was able to put the drive into an enclosure and gain access to the files and recover the MySQL data folder.
We are mostly a Windows company and I have very limited linux experience. Before this machine crashed we were experimenting with moving this blog to a Windows Virtual Machine running PHP for IIS; and we have an older copy of the Wordpress database up and running on MySQL 5.1.
I am currently trying to retrieve the latest data from the linux MySQL data folder and import it into the current database but I am having problems.
Problems so far:
I do not know what version of MySQL was installed on the linux box
I see ib_logfile0, ib_logfile1, and ibdata1 on the linux MySQL data folder, but am not sure if it was truly running InnoDB or not as I also have .frm, .myd, and .myi files in the wordpress folder
If I can figure out the version of the linux box MySQL I might be able to create a virtual machine to run linux and MySQL so I can copy the data folder and then do an export dump; unless someone else knows of an easier way to get the data into my current database.
Any help or guidance on this issue would be greatly appreciated.
Thanks, Nathan
Look for "mysql_upgrade_info" file.