export mysql database from another computer without the password - mysql

NOTICE I'm not trying to steal anyone's database
My company works with firebird databases and there's this client who already has a system in their company, but they are interested in changing to ours, only if we can export their data from the old system, the problem is that they can't ask for the mysql password and I can't change the root password otherwise their system will stop working.
I have access to the folders and I already copied all the mysql folder to my computer
I have the same version of the client

Related

Can you copy a MySQL database without a front-end software involved?

I was told that you cannot copy a MySQL database without using the front-end software (in this case Citrus Savings and Loans) that was built along with it.
A brief history: A certain IT company created a front-end software and used a free version of MySQL as its database. Of course they set up a root password for it. Now they do not want to cooperate by migrating it to our new server or at least give us the root password to copy the database.
My question is this: Is the root password exclusive to the front-end software or is it just the MySQL root password? Also, since the IT company doesn't wanna help, is there a way to copy the old MySQL database without the root password nor the Citrus Savings and Loans front-end software and save it to our new server?
NOTE: I just found out that the IT company used WAMP as the server.
Anyone can copy a MySQL database if you have access to the filesystem. Without direct access to the filesystem, youcan still create MySQL dumps if you have a mysql username with at least read access.

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.

Cpanel mass DB import from root user

I have been tasked with migrating a VPS previously build on a very shady centos 5 system (no hosting environment) into a perfectly working centos 7/cpanel environment. The old server setup had 29 websites using the root MySQL user/password in order to get his connections to work. I imported the databases and matched the root password but this is really not an ideal setup because the databases are not linked to the cpanel user and well using the root password in production is very bad...
So my question is, now that the databases are on the server (can only be seen from the root phpmyadmin) how can I link them to a cpanel account?
From the root PHPMyAdmin in WHM, there was no "user" tab which is odd. I guess cpanel made sure all the databases were created from its cpanel system. But how can I link all the databases if I can't access that page? If the only way is by SSH, is there a way to do them all in batch?
There is no automated way to do this as far as I know.
The best option (unfortunatelly it involves some work and non automated actions) is to login to each of the accounts cPanel account (you can do that from WHM by clicking on the cPanel account which is displayed next to the cPanel account when you use List Accounts) and then use the SQL section to create a new database, a new user for that database, provided grants to that user.
Then you can use the Database Map Tool available in WHM to grant access to that database to a specific cPanel user, map rights and so on. You have to repeat this for each of your cPanel accounts. Last but not least, you'll have to modify the configuration files for each of your websites to reflect the new mysql settings (db name, user, password etc).
I know this is a slow and step by step method but it would be the best and safest especially that 29 accounts are not that much.

Restore .sql export to WordPress db from within WordPress?

I've been developing a client's site and have maintained .sql backups using Export of phpMyAdmin. Yesterday my client provided me with credentials for the destination server and asked if I could migrate the development site to the beta site.
I can copy the files, of course, and I have changed wp-config.php to point to the new database correctly. When I load the page initially a default WordPress installation is created.
Unfortunately, I was not provided cPanel or phpMyAdmin credentials.
Ideally, there would be a plugin or script that would drop all of the existing tables created by default and use my .sql export to recreate the tables and populate them with data.
Does anyone know if there is a way to import this .sql from within WordPress?
You can import it with mysql on the command line:
mysql -u someuser -p password <yoursqlfile.sql
Or you can open it in mysql workbench (download from mysql.com) and run it from there.
In case you cannot SSH to the server or access the database via workbench as Norbert suggested, you can try XCloner.
It would be better if you had some sort of direct access to the database, but I'm guessing if you do not have cpanel access you also do not have SSH access. It is also common for databases to be restricted to local access, so a remote connection via MySQL Workbench may not be an option.
If for whatever reason none of these solutions work, you can temporarily connect the site to a remote database that you have access to until you get the necessary credentials from the client.

Gaining access to mysql given physical access to the machine

I own a machine running third party software. I input data into this software and it stores that data into its own mysql database. I'd like query the mysql database directly, but I don't know the credentials that the application is using.
I have read and write access for all files in the machine, including the files in the mysql data directory. Theoretically, I should be able to read the data directly from these files (.ibd and .frm files). But practically, I don't know where to start. I'm thinking that these data files are somewhat readable since encrypting them would destroy their index-ability.
Is this feasible? Or would I have to reverse engineer the data file format in order to read it?
Or even better - is there some config file that I can change which would implicitly trust all local connections similar to postgres?
You could read the mysql files directly, but even if they're now encrypted, the columns names might be weird and you could have to spend some time reading them.
Another point could be looking for config files from that software, that could have the login/password (very very low probability, but who knows?)
And the best would be:
make a backup of the mysql files
in another mysql instalation / computer (to not break your software), follow the reset mysql password guide
Try accessing it via the command line on the local machine:
shell> mysql db_name
(from MySQL documentation)
From here, you can create yourself an account if you need to connect from other client software.
Or have you already tried that?
If you have root access to the machine that MySQL is running on, then you can reset the MySQL root password by following the procedure at: http://www.cyberciti.biz/tips/recover-mysql-root-password.html. Once you've reset the root password, you can then login to MySQL as the root MySQL user, and access any of the databases, and query them. The only caveat to keep in mind is that changing the MySQL root password could potentially prevent your application from accessing the MySQL database, but that would be surprising as the application should be designed to connect to the database using a MySQL user account (with limited privileges) other than the root MySQL user.