Mysql Table corrupted after restarting PC - mysql

I am working on Symfony2 Project and am beginner in symfony Framework. I am using XAMPP as webserver. Everything is working properly until system restarts. When I restart my computer the tables of mysql database using by symfony project corrupts automatically.
I am using windows 7 professional 32bit OS.so, is there any problem in mysql?

MySQL tables can become corrupt for several reasons, such as hardware
failure, operating system bugs, viruses and bugs in MySQL. hMailServer
itself does not cause corrupt MySQL tables. hMailServer communicates
with MySQL over TCP/IP using a standardized language.
There's nothing in this language that can cause corrupt tables.
If a MySQL table becomes corrupt, you need to repair it. Note that repairing a corrupt MySQL table may lead to loss of data. It's therefore important to create a backup of your system.
How do you know whether a table is corrupt?
Examine the hMailServer error log. If you see a lot of Error while executing SQL statement-messages, then it's likely that one or more of your tables are corrupt. Feel free to ask in the forum if you're unsure.
Step 1: Determine MySQL password
If you are using an external version of MySQL, you should already know your MySQL password.
If you are using the built-in MySQL version that comes with hMailServer, you might not know your password. To determine it, follow these steps:
Run the script hMailServer/Addons/Utilities/DecryptBlowfish.vbs.
Enter your main hMailServer Administrator password. This is the
password you specified during the installation when you first
installed hMailServer. Click OK.
Open up hMailserver.ini, located in your Windows directory or
hMailServer bin directory.
Copy the database password from hMailServer.ini to the "Enter
encrypted password" dialog. In hMailServer.ini, you should see a
line looking like this: [Database]
...
password=c85dae3cb73394ab
In this example, c85dae3cb73394ab is the encrypted password.
Click OK in DecryptBlowfish to view your password
DecryptBlowfish will now show your password. Either keep the dialog open or memorize the password.
Step 2: Connect to the server
To be able to repair your table, you need to connect to the MySQL server using a MySQL client. You can use SQLyog for this.
Download and install SQLyog
Create a new connection.
Enter the connection information for your MySQL server. If you are
using the built-in server, you should enter hostname: localhost,
user:root, password:password from DecryptBlowfish, port:3307
Click Connect to connect to the database server
Step 3: Repair the table
Follow these steps to run the SQL statement to repair the table.
In the tree to the left, click on the hmailserver database.
The hMailServer database will now be active.
In the right part of the SQLyog window, click on the Query tab.
Enter REPAIR TABLE tablename, for example, REPAIR TABLE hm_messages.
Click on the Execute Current Query button in the toolbar (or select
Edit->Execute Query->Execute current query or press F5).
MySQL should now repair the table. After the table has been repaired, restart the MySQL and than the hMailServer service. Depending on what table is corrupt, a restart of the services may not be required, but we recommend that you always do it.
Source

Related

NetBeans not showing all MySQL databases

I've some databases showing at MySql command line client as in the image below:
But in netbeans only the databases below are showing of the same localhost:3360 used by MySql command line client:
Why all of my databases are not showing in netbeans?
NetBeans uses the same show databases command to load the list of databases to the database explorer. You can see the source code for it here.
The show databases command only shows you those databases for which you have some kind of privilege.
You see only those databases for which you have some kind of
privilege, unless you have the global SHOW DATABASES privilege. You
can also get this list using the mysqlshow command.
So, ether NetBeans connects to a different MySQL server or you use a different user within the NetBeans connection.

MySql tables disappeared and showing a table named as 'warning'

We were having a MySql Server running in Azure Windows Virtual Machine. We were not using it for the past 6 months. But recently we logged into the Virtual Machine and tried to access the database using MySql Work Bench. But it doesn't accept the password and we were unable to login. So we changed the root password by following the instructions from MySql documentation (Resetting the Root Password: Windows Systems).
Based on the instructions, the following commands were executed to reset the password:
CD C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe
mysqld --no-defaults --datadir="C:\\ProgramData\\MySQL\\MySQL Server 5.7\\Data" --init-file=C:\\mysql-init.txt
After running the command, we were able to resect the password and logged into the Mysql as a Root user via the workbench. But, There were no tables other than tabled named as 'warning' in the databases. Following is the screenshot from the MySql Workbench. You can see the 'warning' tables is having four fields namely id, warning, Bitcoin_Address, and email. But there are no rows having values for these fields.
Is there anyone who knows what is exactly happened here? Any way to recover the missing tables? We were not having any other backup for these databases.
After 1 year 15 days. Most probably you have been hacked. I too had this issue in my raspberry pi server, which I used for the weather monitoring. But thanks don't have that important data to pay for it. Before coming to the conclusion check a few things.
How To Fix Corrupted Tables in MySQL, If not solved then,
log in to your mysql database in the terminal, query SHOW database, query USE database_name, query SHOW TABLES;
as mentioned, if you see only one table named WARNING,
Then, query CHECK TABLE `WARNING`;
In the displayed table, if you see under column Msg_text = OK
Then, query SELECT * FROM `WARNING`;
There you have your answer, A hacker has hacked your database, and is demanding money in bitcoin.
Solution: I don't trust them, they will not return your data. Best don't fall for the trap. Instead, use a strong password in your database, use ssh in your site (if you are using), use a python script to daily backup your database through CRON task.
Sorry, If you are a victim of a hacker. I cannot be of much help then.

How to recover deleted mysql database

I have a mysql workbench on my server and today I checked just my all schemas are deleted resulting in halt of other application.I am confused how it has happened.Is there a way to check who has last connected to my workbench as few ppl have its access and how can I recover the lost database or there could be another reason for lost of all databases
MySQL Workbench is a client tool. If you installed it on a database server, then perhaps you should be checking who was logged on to the db server and that will be appropriately logged by the O/S. You might also want to review your security policy because it sounds like you might be sharing passwords and review which user accounts have DROP privilege on the databases.
Your databases might not show in Workbench if the connection is not properly configured (but the applications not working would suggest otherwise).

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.