MySQL in XAMPP stops unexpectedly whenever an activity is created in MOODLE - php

First of all we created a moodle site on our local machine. Afterwards we integrated our work using TFS (Team Foundation Server). Now we changed the ibdata1 file in our database which includes the change of all people and took the latest version of the site from TFS. But now whenever any activity or resource is being created in MOODLE site, mysql stops unexpectedly and says DATABASE READ AND WRITE ERROR; while login takes place effectively and reads the username and password from database. The error message shows that your database must be corrupted or you may not have the priveleges or block port or shutdown by another method. While log shows database "you have moved .frm files to another database?
or, the table contains indexes that this version of the engine
doesn't support." and sometimes "The InnoDB memory heap is disabled". Please help.

Have you copied the database frm files rather than doing a data dump? This won't work. You need to do a database dump and restore.
On the original server either use phpmyadmin or mysqldump. Phpmyadmin should be already installed by xammp
If the server is your local machine, you can access phpmyadmin via
http://localhost/phpmyadmin
Then go to database name, click the export tab and click go. This will download an sql file.
Then on the destination server, do the reverse. Go to phpmyadmim, you will need to create a blank database, then click the import tab and select the sql file.
Also copy the moodle data folder, this is a straight forward copy.
http://docs.moodle.org/26/en/Moodle_migration
Don't try to merge 3 databases, the id's will be out of sync and the data will be completely useless.
If the code from the other developers has been written correctly, they will have install.xml files and possibly upgrade.php or install.php files to make any structure changes to the database.
http://docs.moodle.org/dev/Upgrade_API

Related

MySQL / PHPMyAdmin

I've recently taken over a WordPress site from another 'dev' company. The site is highly unstable and not delivering what the client needs. So, I'm currently trying to export the site wholesale to one of our company server.
Numerous backup plugins have failed for various reasons, so I'm now trying to get an export of the MySQL database via phpmyadmin to import into our MySQL server. I've taken a full export from the old server and tried importing it into the new server via phpmyadmin . However, this fails after a period of time, with no real indicator of why.
Next, I exported every table individually and tried to import them to the new server. The first 2/3 or so appear to work but then the latter 1/3 all fail to import with the output/error message saying that the table has multiple primary keys declared.
I really need to export the database structure and data from the old server and transfer it to the new one. So, I'm really perplexed as to what my next move could be. If these tables have multiple primary keys and this prevents an import, how were they created in the first place??
What can I do to remedy the situation and get the data migrated?
This could be a problem of the dump you get. If it was too big, your phpmyadmin would just break down after a while. If you have ssh access to your server you could easily import your dump by shell after uploading your dump file to your server. If this is not possible you could maybe work with a big dump script http://www.ozerov.de/bigdump/ which automatically imports the dump partially, so there is no server timeout anymore.
It appears that this was related to some limiting factor with PHP / phpMyAdmin. I was able to import the generated SQL scripts via the SQL tool in Virtualmin / Webmin without any apparent issue.

Where is the Database File stored in PHP

I've Installed XAMPP Server, and running localhost for web development Purposes. And Database used is MySQL, In MySQL installation i've created a user named "Rahul" And set a Password for that user.
And this PHP script :https://www.dropbox.com/s/mxeq8o2cryvmps5/Php.php?dl=0
Returns "Database created successfully", So where is the Database file stored Physically on my PC,
How can i Find the Database (.db/.mdb) File, So as to directly View and Upload to a hosting server?
Open phpMyAdmin and Click on database which you want to you want to upload to the server.
then click on Export option and then choose SQL and press go.
It will create the .sql file which contains all the queries which will create exact copy of your database on server.
and if you currently wanted to see which data it contains then export that database in other format such as CSV or wordpad or PDF format...
While you want to upload that database on server just go in phpMyAdmin of server and import that .sql file...

Updated to MAMP 3 and lost my database files

I recently updated to MAMP 3 and as a result see to have lost all of my database files. When I start the servers, and load up my developed websites it begins a wordpress install from fresh. I can see the db files in the directory but they don't seem to load in phpmyadmin. Does anyone know if it is possible to recover the database file and website to previous functionality or what I can do to restore the site back to normal.
Any help would be much appreciated.
Thanks.
if you host is not making backup, there's no way to get the DELETED data back.
however login to cpanel and click on backup, click on generate & download a backup, check if it has a option "system generated backup" and has a button called weekly.
if there's a weekly button, that should give you the backup when the main server owner Ran the backups.
http://forums.cpanel.net/f49/my-database-removed-accidentally-how-recover-155173.html

How to upload database(php)?

I have develop one web site in php.
I know how to upload it using ftp(filezilla).
But i dont know how to upload database and i can't do any thing without uploading this database.
please help me to upload my database.
Thank you.
tl;dr version
Ask your hosting provider what methods they support.
More detail
It all depends on your hosting. Do you have a simple hosting account with only FTP access (i.e. no command line or remote desktop access)? In these cases your host usually has phpMyAdmin installed or an alternative web based database management system.
It's unlikely, but you could also try connecting to your MySQL database from your computer. You can download the command line tools or simply get MySQL Workbench, and put in your hostname and test the connection.
If you do have shell access, you can dump your local database with mysqldump and upload the resulting SQL file, then import that on the server. A similar technique can be used with remote desktop.
Normally you could make a gzipped .tar.gz of your DB dump and upload it with a file client to your space... once done unzip it and restore from dump using a mysql commandline or some GUI provided by the site admin.. i'm assuming your DB is MySql as its the obvious choice and you have the privilege to access the DB.... this question seems more suited for serverfault as it seems to have less relation to programming in general. Anyhow
To Tar:
tar –cvzf tarfilename foldername
Untar:
tar –xvzf tarfilename
Example:
tar –cvzf abc.tar.gz abc
This will zip [tar] the abc folder with the name abc.tar.gz
tar –xvzf filename.tar.gz
This will unzip [untar] the file as abc folder.
To backup and restore from dump please refer this link as it has some brilliant illustration.
If you're using MySQL, just export the database from your localhost (phpmyadmin)(click on the database and then search for the export tab ).
When you export it, you need to import it to your online host (your domain).
And to do this, you have to have access to the cpanel of your host.
After logging in to your cpanel , search for phpmyadmin (or whatever database you're using).
Create a database and import your database.

Loading lots of data into MySQL without SSH access?

I wanted to connect to my server via ssh and run a php script to enter some data into the MySQL databases.
I couldn't do this because I didn't have ssh access.
So instead I'm just going to put a php script into one of my web pages and then put the data in the same folder and then run the php by loading the browser
this seems like a really wierd way to enter data into a database?
but is it ok?
Using a PHP script to execute an SQL script should not be a problem (but be sure to delete both afterwards, just so you don't leave an unvalidated/regulated passage into your database out there).
If your webhost provides a MySQL Admin interface (often phpMyAdmin), you should be able to access that through their Control Panel (often called "cPanel" or "Plesk"). You should be able to upload and execute an SQL file through that interface without installing anything else.
Failing that, you should be able to install Adminer, which is a cutdown version of phpMyAdmin which you can then upload to your server and access through a web browser to, again, upload or copy-and-paste your SQL script into.
So you are basically rebuilding phpMyAdmin's behaviour. I would just install phpMyAdmin, but if your php script is protected (.htaccess or similar), then this should be no problem. Look out for timeouts.
A good tool for working with MySQL db is Workbench, but you must have remote access to your db...

Categories