I have installed MySQL from Ubuntu software center, MySQL client and MySQL workbench as well.
the problem is I cannot do anything but to call sudo mysql start and sudo mysql stop
when i try to run the following command sudo /usr/bin/mysql_secure_installation i am prompted to enter the root password, i didn't set the root password so i just clicked 'Enter'
I got the following
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I went to /var/run/mysqld and i have found that it is completely empty.
Update
I don't know if that would help, but I have tried to find the PID file by using find / -type f -name "*.pid" command . I haven't found any files related to mysql with the extension .pid
I was removing the installation without sufficient commands, as it seems, finally i have removed it using the following :
#sudo service mysql stop
#sudo killall -9 mysql
#sudo killall -9 mysqld
#sudo apt-get remove --purge mysql-server mysql-client mysql-common
#sudo apt-get autoremove
#sudo apt-get autoclean
#sudo deluser mysql
#sudo rm -rf /var/lib/mysql
#sudo apt-get purge mysql-server-core-5.5
#sudo apt-get purge mysql-client-core-5.5
This time i have removed the user as well. I didn't know that would matter. anyway after reinstalling it again it worked just fine
Related
I am trying to migrate mysql databases from one server to another. I am following these steps for the migration (270GB of data including databases and users in datadir):
sudo service mysql stop
sudo apt-get purge mysql-server-5.5 mysql-common
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo ln -s <path to datadir>/mysql /var/lib/mysql
sudo apt-get clean
sudo apt-get purge mysql*
sudo apt-get update
sudo apt-get install -f
sudo apt-get install mysql-server-5.5
This asks for root password, which I try to set accordingly. However, I am getting the following response:
Configuring mysql-server-5.5
Unable to set password for the MySQL "root" user
An error occurred while setting the password for the MySQL administrative
user. This may have happened because the account already has a password, or
because of a communication problem with the MySQL server.
You should check the account's password after the package installation.
Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more
information.
Note that I followed the same steps on another ubuntu server (dev) based on the same AMI and was successful in doing the setup. The only variable between the two is data.
I cannot afford much downtime, and therefore using rsync for data replication.
I know that both the ubuntu and mysql versions are old, but this migration is necessary and has strict deadlines.
The solution here was pretty simple.
Rebooting the ubuntu server after following the steps to purge mysql* worked for me. Steps:
sudo service mysql stop
sudo apt-get purge mysql-server-5.5 mysql-common
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo ln -s <path to datadir>/mysql /var/lib/mysql
sudo apt-get clean
sudo apt-get purge mysql*
Reboot the ubuntu machine.
Then:
sudo apt-get update
sudo apt-get install -f
sudo apt-get install mysql-server-5.5
I had installed MySQL in my Ubuntu OS PC. But during the config setup, I had mistakenly set Disallow root login to Y. The MySQL Workbench was not able to connect. I accessed the config file from the terminal prompt:
sudo nano /etc/mysql/mysql.conf.d/mysql.cnf
I noticed that it did not have any config. It only had the following lines:
#The MySQL client configuration file
#Refer to https://dev.mysql.com/doc/refman/en/mysql-command-options.html
[mysql]
I entered the line
bind_address = 0.0.0.0
password = mypassword
But still unable to connect MySQL Workbench. From the terminal, I was now unable to login to MySQL
I tried to uninstall MySQL and reinstall it with the following commands:
sudo apt-get remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-mysql
sudo apt-get dist-upgrade
sudo apt-get install mysql-server
The last command did not proceed with the configuration. I had hoped that I will be able to set the Disallow root login to Y.
How do I uninstall/ reinstall MySQL and have MySQL Workbench connect to it.
Here's how I solved my problem First I uninstalled MySQL (again). Next, I decided to install XAMMP. I followed the how-to steps in one online resource. I launched the XAMPP and was able to connect to localhost/phpmyadmin. I was able to create a database and table, and add a record
I tried everything and I am still unable to start the MySQL service. The error is as below:
[root#localhost ~]# service mysql.server start Starting MySQL.....
ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).
[root#localhost ~]# service mysql start Starting MySQL....
ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).
Things I tried:
Removing the .err file and restarting, no use. Creating a .sock file and a .pid file as the above error mentions, still no use. Almost tried all the steps in most of the forums, still nothing.
I tried all the config files, nothing seems to resolve my issue.
Try the next steps:
First remove MySQL:
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
Then reinstall:
sudo apt-get update
sudo apt-get install mysql-server
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
After these steps mysql process should be up and running. Anyway, if this is not happening ( you can verify by typing sudo service mysql status ) just try:
sudo service mysql start or sudo /etc/init.d/mysql start
I strongly reccommend to post your log files (/var/log/syslog) for mysql if you get any problems, so that we can advice you properly.
If you're still getting the same error, please check for svs answer from this SO question
I somehow have messed up my MySQL on my Ubuntu server and cannot fix it. I have tried every single combination of apt-get remove --purge mysql-server, apt-get autoremove, apt-get purge, Googled for hours and nothing.
I have literally given up. Every time I try to reinstall I get error. I've had enough. I want to remove every single file associated with MySQL on my server.
I get this error every time I try to reinstall which seems to be common but not one "fix" has worked for me. I need to clean my system of everything MySQL.
Unable to set password for the MySQL "root" user
An error occurred while setting the password for the MySQL administrative user. This may have happened because the account already has a password, or
because of a communication problem with the MySQL server.
You should check the account's password after the package installation.
Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more information.
Please can someone give me a set of command to purge this ungodly database from my system before I do a fresh install of the server.
Setting up mysql-server-5.5 (5.5.38-0ubuntu0.14.04.1) ...
140811 10:56:44 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.5 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.5; however:
Package mysql-server-5.5 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for libc-bin (2.19-0ubuntu6.1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:
mysql-server-5.5
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
I have literally tried everything. Every single mysql file is removed and it still will not install properly.
To completly remove Mysql from Ubuntu :
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
after this, if you are having issues with re installing, Try to remove Mysql files in :
sudo rm -rf /var/lib/mysql
I experienced a similar issue on Ubuntu 14.04 LTS after a MySQL update.
I started getting error: "Fatal error: Can't open and lock privilege tables: Incorrect file format 'user'" in /var/log/mysql/error.log
MySQL could not start.
I resolved it by removing the following directory: /var/lib/mysql/mysql
sudo rm -rf /var/lib/mysql/mysql
This leaves your other DB related files in place, only removing the mysql related files.
After running these:
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
Then reinstalling mysql:
sudo apt-get install mysql-server
It worked perfectly.
Different solution for those still having issues. Hopefully I can help those trying to reinstall Mysql. Note, It's a seek and destroy mission. So be weary. Assuming your root:
apt-get purge mysql*
apt-get purge dbconfig-common #the screen used for mysql password
find / -name *mysql* #delete any traces of mysql
#insert apt-get cleanups, autoremove,updates etc.
Originally, something leftover was interfering with my startup of mysqlserver-5.5. These commands ended up resolving the issue for myself.
The following works:
sudo apt-get --purge remove mysql-client mysql-server mysql-common
sudo apt-get autoremove
Use apt to uninstall and remove all MySQL packages:
$ sudo apt-get remove --purge mysql-server mysql-client mysql-common -y
$ sudo apt-get autoremove -y
$ sudo apt-get autoclean
Remove the MySQL folder:
$ rm -rf /etc/mysql
Delete all MySQL files on your server:
$ sudo find / -iname 'mysql*' -exec rm -rf {} \;
Your system should no longer contain default MySQL related files.
sudo apt-get remove --purge mysql*
Remove the MySQL packages fully from the target system.
sudo apt-get purge mysql*
Remove all mysql related configuration files.
sudo apt-get autoremove
Clean up unused dependencies using autoremove command.
sudo apt-get autoclean
To clear all local repository in the target system.
sudo apt-get remove dbconfig-mysql
If you also want to delete your local/config files for dbconfig-mysql then this will work.
This is what saved me. Apparently the depackager tries to put things in the wrong tmp folder.
https://askubuntu.com/a/248860
Remove /etc/my.cnf file and retry the installation, it worked for me for exactly same problem. :-)
remove mysql :
sudo apt -y purge mysql*
sudo apt -y autoremove
sudo rm -rf /etc/mysql
sudo rm -rf /var/lib/mysql*
Restart instance :
sudo shutdown -r now
I just had this same issue. It turns out for me, mysql was already installed and working. I just didn't know how to check.
$ ps aux | grep mysql
This will show you if mysql is already running. If it is it should return something like this:
mysql 24294 0.1 1.3 550012 52784 ? Ssl 15:16 0:06 /usr/sbin/mysqld
gwang 27451 0.0 0.0 15940 924 pts/3 S+ 16:34 0:00 grep --color=auto mysql
I am new in Ubuntu, I installed XAMPP in my Ubuntu 10.04. When I start XAMPP it says MySQL couldn't start.
Here is my terminal ouput:
$ sudo /opt/lampp/lampp start
Starting XAMPP for Linux 1.8.0...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
XAMPP: Couldn't start MySQL!
XAMPP: Starting ProFTPD...
XAMPP for Linux started.
And then as I go to http://localhost, I got stuck on the XAMPP splash-screen, nothing happens if I choose language.
This Worked For me as a Charm. [I used Ubuntu 12.04 and Xampp]
sudo chmod 755 /opt/lampp/etc/my.cnf
sudo chmod -R 777 /opt/lampp/var/mysql
sudo chown -hR root:root /opt/lampp
& Now Start Your Xampp
It might just be that the /opt/lampp doesn't have the right permissions. Before reinstalling everything, try running the commands below, it worked for me:
sudo /opt/lampp/lampp stop
sudo chmod 755 /opt/lampp/etc/my.cnf
sudo chmod -R 777 /opt/lampp/var/mysql
sudo chown -hR root:root /opt/lampp
sudo /opt/lampp/lampp start
Just remove the version where the MySQL is not started with the command rm -rf /opt/lampp
and the command:
tar xvfz xampp-linux-1.8.1.tar.gz -C /opt
Replace xampp-linux-1.8.1.tar.gz with your file name. After restarting your lampp, it will work fine.
You may not have completely removed your old lampp instance. Please remove it and install lampp once again.
It might be the right permissions problem. Some solutions guide you to set it to 777 which is not recommended. Try to set it to original permissions as installed. (especially after you restore from a tar without preserving the permissions)
sudo /opt/lampp/lampp stop
sudo chown nobody.root /opt/lampp/var/mysql/cdcol /opt/lampp/var/mysql/mysql /opt/lampp/var/mysql/phpmyadmin -R
sudo chown nobody.nogroup /opt/lampp/var/mysql/yourdbname -R
sudo /opt/lampp/lampp start
Even I had the same issue. Always check for the error log before proceeding to find the root cause. Sometimes it could be file system space issue. In my case it was "/" file system was full. After clearing some space I was able to start the services without issues.
Thanks,
Vishnu
XAMPP started successfully on my side, but still got stuck at spalsh screen.
It was solved by giving permission to lang.tmp file
sudo chmod 777 /opt/lampp/htdocs/xampp/lang.tmp
Your previous MySQL installation might be blocking your MySQL from the xampp bundle. I also had the same problem. Just uninstall the previous MySQL. Open the terminal(Ctrl ALt T) and paste the following code:
First stop XAMPP:
sudo /opt/lampp/lampp stop
Uninstall MySQL:
sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-5.5 mysql-client-core-5.5
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean
Start XAMPP:
sudo /opt/lampp/lampp start
I found the answer. First completly uninstall the lampp and then reinstall it. Before uninstalling, stop the lampp using the command:
/opt/lampp/lampp stop
and then uninstall/remove it using the command
rm -rf /opt/lampp
then reinstall it.