How to recover deleted mysql database - mysql

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).

Related

Accidentally deleted MySQL users

I accidentally deleted all users in MySQL including localhost. Now I can't even access my connections. How can I add localhost use to access my connections?
localhost is not a user, it's a special host, referring, well, to the local host. That means the host machine the software in question is running on.
So, when using a MySQL Client software like Navicat, localhost means that you want it to connect to a MySQL database that is running on the same machine as Navicat itself, instead of connecting over the network to a database running on some remote machine.
Now, regarding your question, if you deleted the user table (or its content) from the MySQL database running on your localhost, the only way I know of to bring the users back is restoring a backup of the database, if you have one.
You might be able to get access to the database again by recreating the user table using the mysql_install_db script as pointed out here, but this won't recover the previously existing users.

phpMyAdmin Virtual MySQL Instance

Currently I have phpMyAdmin and MySQL installed on my server. I now want to provide access to phpMyAdmin to a friend of mine so he can setup his own databases and users, however I don't want him to be able to see or modify my databases.
Is this possible to do with a simple privilege account or do I require some kind of MySQL virtualization? I know cPanel installations provide this feature for web hosts, but I don't need or can afford cPanel at the moment.
You should look into MySQL Security Here specifically section 13.7.1.3 Grant statement. You could secure your DB from your friend logging in which will prevent him from seeing anything in that DB on PHPMyAdmin. Or you could create a DB for him to use and allow him access to that DB only.
You never mentioned if he will be on Localhost or will you need to open up MySQL for remote logins from other than Localhost which is the default behavior..

multiple machine MySQL through Workbench

I have recently started using MySQL Workbench, hence I apologise if this is not the proper platform to ask this question. I tried to figure out the solution of my own, but could not find any appropriate one.
Here is my situation: At my workplace, we have a huge set of data about the operational and financial figures such as sales, employee, profit, etc for European companies spread over past 7-8 years and new data keeps coming regularly. However, the problem is we work from different remote locations, me in one city and the other two colleagues in a different city. Normally, we share our work files (.xls/.doc) etc through Dropbox. So, we thought of creating a database in MySQL wherein we all can submit/edit/add this data so that we can filter and analyse this data on several ways once the collection is complete. And we plan to use and access it thereafter. We believe that this is ease a lot of our work. So all I want to know is: can all three of us collaborate simultaeousy (in order to add or edit the data) through workbench Server administration, like the way we collaborate our work through Dropbox? I want to be the host (like the administrator) and then want to allow the access to my colleagues.
Thank you for your time and answer. You may also refer me to any site or link to read more about it.
I think you are a bit confused about what MySQL Workbench is.
MySQL workbench is just a data viewer and administration tool that connects to a MySQL server, there's no data "stored" in MySQL workbench, all the data is stored in the server.
MySQL workbench can:
Connect to a MySQL server
Send SQL instructions and show the results: You can create and drop databases, send SQL queries, create and execute stored procedures and functions... all assuming you have the right privileges.
Perform administration tasks: You can create and drop users, grant or revoke permissions, etcétera
But the fact is: all is stored in a MySQL server... so the answer to your question is: Yes, you can work simmultaneously with your colleagues, if and only if all of you can connect to the same database server (as Mike W commented).
Addressing your comments, and clarifying more details:
MySQL is a database server. When you install it in a computer, all data is stored in that computer (aside from replication and other fine details). You should make regular backups of your data (MySQL has tools for that, one is mysqldump). If you want to access the data stored in your database server, you can do it:
By ussing the command-line client,
By using MySQL workbench or another GUI client program, or
By any program that can connect to the database server (via ODBC or specific libraries).
Focusing on MySQL Workbench, and addressing your specific question: If your machine breaks down, you can install the MySQL Server in any other machine, and load the backup into it. You will have to configure that new machine so that any of your coworkers can connect to it (that may imply that a new set of connection parameters is created).

Mysql Table corrupted after restarting PC

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

TeamCity won't create its schema in SQL Server

I've installed a new TeamCity instance and just moved from internal storage to database (SQL Server). Followed the instructions at http://confluence.jetbrains.com/display/TCD7/Setting+up+an+External+Database and I know I've done the database part correctly as it wouldn't initially connect and I had to go back and turn on TCP/IP connections for SQL Server.
From the documentation I assumed that team city would create and maintain it's own database schema, but even though it's user is dbo the database remains blank - no tables, views or any other objects have been created.
When I try to connect to it in a browser I get "Database is empty or doesn't exist", and viewing the logs shows me "Schema contains no tables". I've obviously restarted the service and connected again each time.
Is there an install script I am missing? How do I get TeamCity to install it's schema?
When you are doing it like this, you will need to migrate the initial structure over to sql server. See here