must re-install WAMP, but want to save my MySQL databases - mysql

After installing a newer version of WAMP both WAMP-Installations won't start anymore. I can't figure out why and don't want to waste more time with it as I have to work on a project.
I would like to uninstall WAMP and reinstall again. How can I save all MySQL-Databases? PHPMyAdmin won't start. I see the database data seems to be in folder C:\wamp\bin\mysql\mysql5.6.17\data
Will it work if I just copy that folder, uninstall, reinstall WAMP and copy all data back from that folder?
Of course I would also copy all data from C:\wamp\www before uninstalling WAMP.
Any help is appreciated.
Milan

Take backup of /var/lib/mysql/<your database>
Reinstall WAMP
Restore <your database> back to /var/lib/mysql
Change ownership & group to mysql by chown -R mysql:mysql /var/lib/mysql/
Start MySQL

Related

Mysql Server not start after Migration Assistant in MacOs

I Used Migration Assistant from ios to put my things in another mac.
But, after that, my MySQL Server does not run!
In System Preferences, my computer say:
the mysql server instance is not running
Whats happing?
I try this:
brew services start mysql#5.7
And receive:
Error: Formula `mysql#5.7` is not installed.
I do not know why, but my system automatically renamed the MySQL directory during the migration process.
I identified that the usr/local/mysql/ directory was now called usr/local/mysql-5.7.21-macos10.13-x86_64/
What I did that solved the problem, was to create a symbolic link
sudo ln -s mysql-5.7.21-macos10.13-x86_64 mysql
I rebooted my mac, and everything worked correctly.
you will probably need to identify the new directory name with the command
ls usr/local

How can I reinstall mysql while restoring DBs without mysqldump?

I'm running MySQL v5.7.25 on Ubuntu 16.04.5. Recently I noticed MySQL was not responding to any connects or service restart. I want to just purge the server and reinstall it but I have databases I want to retain and I can't use mysqldump to save them as sql files because I can't connect to mysql.
Is ther a way to do this, restore the files in /var/lib/mysql after a purge / reinstall. I've all ready archived the contents of /var/lib/msysql in a tarball, I just want to know if it's just a simple matter of copying the backedup files into the /var/lib/mysql directory before I pull the trigger.
don't use purge it removes everything. instead use remove
/var/lib/mysql folder stays untouched when you remove by using apt-get remove. D

Recreate a `mysql.user` table in mysql

I found my mysql.user table is messed up and use drop table if exists mysql.user to drop it, how can I create this special table manually and add my new account to it.
NB I have never tried this so I have no idea if it will work at all. YOU HAVE BEEN WARNED!!
Before you do anything, shut down the MySQL service and take a backup of the data folder (copy it elsewhere).
Next, either try creating a new data directory and run mysql_install_db (from the MySQL install directory, scripts/mysql_install_db --datadir=<new data directory>), or use a virtual machine and do the same. Whatever you do, do NOT install into the original folder. Use the same version of MySQL to do this
Whichever method you use, take the resultant files from <mysql data folder>/data (they should be called user.MYD, user MYI and user.frm) and copy them into your broken folder. Ensure that user rights are the same as the rest of the folder (owner and group should be read/write).
Restart your MySQL service and see if you can get into the system (no login information will be required, but you will have to log in to MySQL as root. If you can, recreate the relevant users for application access. If not, you still have a backup of the data folder.
In the event that it doesn't work, and assuming that you have recent backups, re-create the data folder completely using mysql_install_db (ensuring that you still have the copy of the folder you took before you started out), create the users, then restore your individual databases one by one from your last good backup. Do not restore the mysql database and tables - they will be built as you restore the other databases.
Try all this out on a virtual machine first - it'll help you find any problems along the way
Good luck
Thanks to #DaveyBoy 's answer. I operated like below on ubuntu 16.04, mysql 5.7.20, and got mysql.user table back:
sudo mysqld --initialize --datadir=~/data_tmp
sudo cp ~/data_tmp/mysql/user.frm /var/lib/mysql/mysql
sudo cp ~/data_tmp/mysql/user.MYD /var/lib/mysql/mysql
sudo cp ~/data_tmp/mysql/user.MYI /var/lib/mysql/mysql
sudo chown mysql:mysql /var/lib/mysql/mysql/user.frm
sudo chown mysql:mysql /var/lib/mysql/mysql/user.MYD
sudo chown mysql:mysql /var/lib/mysql/mysql/user.MYI
In mysql cli select * from mysql.user, table mysql.user should show up now.

change mysql.sock path(not under /tmp/) in installation

I am new to building server, I need to install MySQL server on CentOS 5.10 (64-bit). I used source code for the installation as I cannot use the root account.
I have finished cmake, make, make install process, it goes fine, but when I tried to start the server, it said "can't connect to mysql server through socket ". I guess it's because I do not have /tmp/mysql.sock and I cannot find any mysql.sock created under my basedir.
Is there any way to create the mysql.sock under a desired directory? I do not have the access right to the /tmp/ dir, please help!
EDIT
When I cmake the files, I have added options to change data dir, tmp dir, mysql.sock, hoping to create the mysql.sock and the data dir under my desired path, like user/ws1/mysql/,however it seems that doesn't work, is there any way to do so?
After cmake, make, make install, you need to go to /usr/local/mysql/scripts and execute mysql_install_db -u root before starting MySQL. Hope this will help ~
You need to start the server before you connect to it with the mysql command.
To start it try running support-files/mysql.server start .

Create MySQL database in OS X Lion

I am trying to set up a dev environment on my Mac laptop, and I have run into some trouble when installing mysql. When I try to create a database, I get the following error:
ERROR 1006 (HY000): Can't create database 'SummerGypsy_development'
(errno: 2
From what I have gathered, this means there was some problem in creating the database on the disc.
Here is how I installed mysql:
First, using Homebrew, I executed:
brew install mysql
Once that finished, I tried running mysql_install_db, but got an error. To remedy this error, I ended up running
mysql_install_db --basedir=/usr/local/
I can run mysql, but creating a database does not work. I ran
mysqladmin variables | grep datadir
To find where mysql was trying to create the database. The output was: /usr/local/mysql/data
/usr/local/mysql and /usr/local/mysql/data directories do not actually exist, and I have a feeling that the datadir is pointing here because of the basedir I passed into mysql_install_db. As a quick fix, I tried creating both directories, and then running
chown -R mysql:mysql /usr/local/mysql
to give mysql permissions in this directory. This did not fix the problem, though.
Does anyone have any suggestions?
you need to change the permissions in the data.
chown -R mysql:mysql /usr/local/mysql/data
You might want to try installing from the .dmg file (installer, system preferences pane, and startup script) that is distributed directly from MySQL. There is a thread on Getting MySQL work on OSX 10.7 Lion that you might want to take a look at. These steps helped me get MySQL running on OSX Lion. Hope this helps.
I tried lot of the suggestions including the file permission reset with no luck. But i then restarted the mysql using the command "./mysqld_safe &" (excluding quotes) and it worked.