Wednesday, August 1, 2012

Step by step solution on reinstalling MySql on your Debian6 from scratch

apt-get -f install
to correct everything

delete the old existing database files in /var ... - delete the whole mysql/ folder.
http://stackoverflow.com/questions/2659782/where-is-the-actual-data-in-a-mysql-db-stored-on-a-linux-machine

It is installation specific, but if you've /var/lib/mysql , then:
  • MyISAM tables will be stored in individual files in /var/lib/mysql/databasename/
  • InnoDB resides in /var/lib/mysql/ibdata (unless you've used the innodb_per_table setting, in which case it's stored much like for MyISAM tables)

http://www.mkyong.com/mysql/where-does-mysql-stored-the-data-in-my-harddisk/
http://www.cyberciti.biz/faq/mysql-datadir-files-stored-unix-linux/
http://library.linode.com/databases/mysql/debian-6-squeeze
where are the mysql databases stored in linux - Google Search


remove mysql
http://serverfault.com/questions/111358/how-do-i-completely-remove-mysql-server-on-debian

removing mysql-server does not work because mysql-server is just a metapackage that depends on the specific server version
apt-get remove --purge 'mysql-.*'
or
apt-get remove --purge 'mysql-server.*'
will do the trick.


apt-get --purge remove mysql-client* mysql-server*


The following packages will be REMOVED:
  mysql-client* mysql-client-5.1* mysql-server* mysql-server-5.1*
  mysql-server-core-5.1*
0 upgraded, 0 newly installed, 5 to remove and 11 not upgraded.
After this operation, 53.1 MB disk space will be freed.


mysql-common*



http://stuffthatspins.com/2011/01/08/ubuntu-10-x-completely-remove-and-clean-mysql-installation/


http://superuser.com/questions/225826/what-steps-do-i-need-to-take-to-completely-uninstall-mysql
1

I have installed and uninstalled MySQL Server for about 100 times. Each time I reinstall the thing, it shows the same configurations, which I think cause problems. I would like to get rid of all traces of MySQL and install it as if it was the first installation.
I'v already deleted the MySQL folder, but I'm still having the same problem.
How can I start over and reinstall MySQL?
EDIT: My OS is Windows 7.

2

Using Windows 7, here's what I had to do:
  • Uninstall MySQL using the uninstaller
  • Delete C:\Program Files\MySQL
  • Delete C:\Program Files (x86)\MySQL
  • Delete C:\ProgramData\MySQL
  • Delete from any Users' AppData folders. Example: C:\Users\rdoverby\AppData\Roaming\MySQL
  • Reinstall MySQL


how to completely reinstall mysql - Google Search
how to reinstall mysql from debian6 - Google Search

apt-get install mysql-common mysql-server mysql-client

################################################################
Okay, when HeidiSQL gives you the error msg that sounds like you "cannot connect",
it's actually because your HeidiSQL remote user hasn't been given the privilege
from the localhost mysql command line.

Error msg:
sql error 1130 host not allowed connect - Google Search


Do this:
http://richbui.com/2009/03/06/how-to-enable-remote-access-to-mysql-server-on-windows-server/
3 IN YOUR MYSQL, GIVE THE USER REMOTE ACCESS PRIVILEGES
- to find out your FULL username, use the heidisql to connect to that IP, using arbitrary username and password. It will fail, and it will show the FULL USERNAME that was generated for your user on your PC.


Enter in

GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'IP' IDENTIFIED BY 'PASSWORD';

What this will do is create a new user with ROOT privileges, so be very careful what account you are creating. If you are just using the root account, then replace USERNAME with root. And just so we are clear, USERNAME is the account you wish to create or use. IP is the physical IP address of the computer you wish to grant remote access to. If you enter ‘%’ instead of an IP number, that user will be able to remote access the MySQL server from any computer. PASSWORD is the password you wish to create if it’s a new user or the existing password of an existing account. And yes, you need to use the single quotation.

And finally, you want to run this last command:
mysql> FLUSH PRIVILEGES;

To exit, just type:
mysql> quit;



#########################
More details on that error msg (remote user with admin rights)
http://stackoverflow.com/questions/1559955/host-xxx-xx-xxx-xxx-is-not-allowed-to-connect-to-this-mysql-server


Possibly a security precaution. You could try adding a new administrator account:
mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
    ->     WITH GRANT OPTION;
mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
    ->     WITH GRANT OPTION;
Although as Pascal and others have noted it's not a great idea to have a user with this kind of access open to any IP. If you need an administrative user, use root, and leave it on localhost. For any other action specify exactly the privileges you need and limit the accessibility of the user as Pascal has suggest below.
Edit:
From the MySQL FAQ:
If you cannot figure out why you get Access denied, remove from the user table all entries that have Host values containing wildcards (entries that contain '%' or '_' characters). A very common error is to insert a new entry with Host='%' and User='some_user', thinking that this allows you to specify localhost to connect from the same machine. The reason that this does not work is that the default privileges include an entry with Host='localhost' and User=''. Because that entry has a Host value 'localhost' that is more specific than '%', it is used in preference to the new entry when connecting from localhost! The correct procedure is to insert a second entry with Host='localhost' and User='some_user', or to delete the entry with Host='localhost' and User=''. After deleting the entry, remember to issue a FLUSH PRIVILEGES statement to reload the grant tables. See also Section 5.4.4, “Access Control, Stage 1: Connection Verification”.


http://www.webyog.com/faq/content/23/36/en/i-get-error-1130-host-is-not-allowed-to-connect-or-access-denied-or-could-not-connect-.html



####################################
In your config file, by default the bind-ip is set to 0.0.0.0 . So the below website, actually no need. Try to create new REMOTE USER with privileges first, if cannot then only check the

/etc/mysql/my.cnf


Near these lines:



# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0


http://www.ghacks.net/2009/12/27/allow-remote-connections-to-your-mysql-server/








No comments:

Post a Comment