xampp could not be started in ubuntu 12.04? - mysql

I installed XAMPP for Linux a couple of days ago and was working fine. Today I do wrongly
chmod 777 /opt/lampp
then MySQL won't be started. then I completely uninstall XAMPP then again install XAMPP then following message come ::
Starting XAMPP for Linux 1.8.1...
XAMPP: Another web server daemon is already running.
XAMPP: Another MySQL daemon is already running.
XAMPP: Another FTP daemon is already running.
XAMPP for Linux started.
then I tried to stop MySQL by typing::
sudo service mysql stop
Then It shows that ::
mysql: unrecognized service
then I tried to stop apache server by typing::
sudo service apach2 stop
Then It shows that ::
apache2: unrecognized service
Any suggestion ??

Try:
sudo /etc/init.d mysql restart

Related

MySQL 5.7 installed via brew now getting ERROR! The server quit without updating PID file (/usr/local/var/mysql/dev_box.local.pid)

I had mysql version 8 earlier, due to some dependency i had to downgrade to 5.7 so installed mysql#5.7 via brew.
Steps
brew uninstall mysql
brew install mysql#5.7
mysql.server start
brew link mysql#5.7 --force
Now once i have stopped the server and now i want to restart it but i am getting
ERROR! The server quit without updating PID file (/usr/local/var/mysql/dev_box.local.pid).
When i do
mysqld --initialize
I am getting
[ERROR] --initialize specified but the data directory has files in it. Aborting.
[ERROR] Aborting
But when i try to start the server using services it's starting but i am not getting anything in the grep but when i do "brew services list" it's showing that server is started.
but i am not able to login
mysqladmin -u root password 'password'
This gives the error
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
I have tried almost everything from
MySql server startup error 'The server quit without updating PID file '
After MySQL install via Brew, I get the error - The server quit without updating PID file
With no luck, hoping for some quick help.
I had the same situation. What helped me is:
First uninstall mysql using brew
brew uninstall mysql
brew uninstall mysql#5.7
Then manually go through all folders in /usr/local/ and delete everything related to mysql.
For example, I had /usr/local/etc/my.cnf and my.cnf.default, so had to run rm -f /usr/local/etc/my*; also /usr/local/mysql-5.7.21-macos10.13-x86_64 and mysql-8.0.16-macos10.14-x86_64, so rm -rf /usr/local/mysql* and so on.
After this is done install using brew
brew install mysql#5.7
brew services start mysql#5.7

why apache2 server and mysql is not starting in XAMPP?

I am trying to start/restart my apache server and MySQL in the xampp by using the terminal in ubuntu 18.04.
The Commands which I used to restart is :
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/mysql stop
sudo /opt/lampp/lampp restart
I have tried many solutions already.
can anyone give me the idea to start MySQL and apache server?
Thanks in advance.
With limited info provided, your system is probably on systemd, so you can restart using:
service apache2 restart
service mysql restart
Or
systemctl restart apache2.service
systemctl restart mysql.service

MySQL Database stopped in XAMPP-1.8.3.4 in ubuntu 14.04

MySQL already running, but when open http://localhost/phpmyadmin/ I get error like this :
#2002 - Connection refused The server is not responding (or the local server's socket is not correctly configured).
when I try run from command line with sudo /opt/lampp/lampp start, I get the message like this :
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...already running.
I have checked in ps -aux | grep mysqld
I get message like this:
ahmadso+ 7118 0.0 0.0 15948 2220 pts/6 S+ 09:23 0:00 grep --color=auto mysqld
when I try sudo service mysql stop
I get message like this :
stop: Unknown instance:
I use Ubuntu operating system, I have tried to uninstall and reinstall xampp, but does not resolve the issue.
please help me.
Try stopping all XAMPP Services and then start them again:
Stop
sudo service apache2 stop
sudo service mysql stop
Start
sudo service apache2 start
sudo service mysql start

Restarted my pc and suddenly MySQL deactivated in xampp(lampp) on Linux 12.04

It was all working fine for a long time i don't even remember when i installed this Ubuntu on my pc it was more than 6 months for sure.
And i have xampp (it's called lampp) on Linux setup and all was working fine, until suddenly now from last restart i can't run MySQL
When i try to go to localhost/phpmyadmin im getting error
#2002 - No such file or directory
The server is not responding (or the local server's socket is not correctly configured).
When i check localhost/xampp under status it says
MySQL database DEACTIVATED
when i try to restart it i get this
sudo /opt/lampp/lampp restart
Restarting XAMPP for Linux 1.8.3-2...
XAMPP: Stopping Apache...ok.
XAMPP: Stopping MySQL...not running.
XAMPP: Stopping ProFTPD...ok.
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
But still MySQL not working when i do restart again i get same response. When i try to start/stop just mysql i get this
sudo /opt/lampp/lampp startmysql
XAMPP: Starting MySQL...ok.
sudo /opt/lampp/lampp startmysql
XAMPP: Starting MySQL...ok.
sudo /opt/lampp/lampp startmysql
XAMPP: Starting MySQL...ok.
sudo /opt/lampp/lampp stopmysql
XAMPP: Stopping MySQL...not running.
No matter how many times i try to start it it wont start.
/etc/init.d/mysql or service mysql is not installad and it shouldn't be when using xampp
I tried this MySQL deactivated in Lampp, Xampp on Linux 12.04 and this Couldn't start MySQL! while starting XAMPP. and other answers but no luck
I checked all the logs i could find in /opt/lampp folder but no luck. I checked php.ini httpd mysql config and i don't see anything wrong, all the users permissions and passwords are right.
So any help, what could be the problem so it just stops working when i didn't touched anything just restarted my pc.
I encountered the same thing after I dumbly executed restart command to my entire xampp applications, causing my database to shutdown unexpectedly and crashed the mysql application.
I found this link and followed his solution.
In summary what I did was, in my.cnf, search for this:
[mysqld]
w/c for my case is located at /opt/lampp/etc/my.cnf
and directly below that, on a new line, put this:
innodb_force_recovery = 1
Then I properly restarted my lampp applications using
/opt/lampp/lampp/ stop
and then
/opt/lampp/lampp/ start
Then I check using the
/opt/lampp/lampp/ status
and saw my MySQL is now running
then I revert back the innodb_force_recovery value from 1 to 0.
Alright after loosing all night on trying to fix and looking at logs i finally found an .err file inside mysql databases folder.
The .err file lead to some sort of errors while reading some of the database files, apparently they got corrupted somehow and mysql was not able to read them thus stoping execution and crashed. So i deleted that few files of databases and mysql is running again.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' [duplicate]

This question already has answers here:
Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (38)
(43 answers)
Closed 21 days ago.
I installed MySQL on Mac OS X Mountain Lion with homebrew install mysql, but when I tried mysql -u root I got the following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
What does this error mean? How can I fix it?
You'll need to start MySQL before you can use the mysql command on your terminal. To do this, run brew services start mysql. By default, brew installs the MySQL database without a root password. To secure it run: mysql_secure_installation.
To connect run: mysql -uroot. root is the username name here.
This happened after the homebrew install and occurs due to permission issues. The following commands fixed the issue.
sudo chown -R _mysql:mysql /usr/local/var/mysql
sudo mysql.server start
It's probably because MySQL is installed but not yet running. [...] To verify that it's running, open up Activity Monitor and under "All Processes", search and verify you see the process "mysqld".
You can start it by installing "MySQL.prefPane".
The above quote is from the blog Obscured Clarity, "Install MySQL on Mac OS X", where you can also find the complete tutorial that I found most helpful.
Run: brew info mysql
And follow the instructions. From the description in the formula:
Set up databases to run AS YOUR USER ACCOUNT with:
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
To set up base tables in another folder, or use a different user to run
mysqld, view the help for mysql_install_db:
mysql_install_db --help
and view the MySQL documentation:
* http://dev.mysql.com/doc/refman/5.5/en/mysql-install-db.html
* http://dev.mysql.com/doc/refman/5.5/en/default-privileges.html
As others have pointed out this is because MySQL is installed but the service isn't running. There are many ways to start the MySQL service and what worked for me is the below.
To start the service:
Go to "System Preference"
At the bottom pane there should be MySql icon.
Double click that to launch the 'MySQL Server Status' and press the button 'Start MySQL Server'
My env:
Mac Yosemite 10.10.3
Installed Package: /Volumes/mysql-advanced-5.6.24-osx10.8-x86_64
Solutions revolve around:
changing MySQL's permissions
sudo chown -R _mysql:mysql /usr/local/var/mysql
Starting a MySQL process
sudo mysql.server start
Just to add on a lot of great and useful answers that have been provided here and from many different posts, try specifying the host if the above commands did not resolve this issue for you, i.e
mysql -u root -p h127.0.0.1
The designated data directory /usr/local/var/mysql/ is unusable. You can remove all files that the server added to it.
MacOS:
$brew services stop mysql
$brew services list
$brew uninstall mysql
$brew install mysql
$brew postinstall mysql
If Any error found then run those cmd
! Warning: this will delete any databases on this server:
$sudo rm -rf /usr/local/var/mysql
$sudo rm /usr/local/etc/my.cnf
$brew postinstall mysql
$brew services start mysql
$mysql_secure_installation
Completed All process of secure installation then run
$mysql -u root -p
Congratulations you’ve just set up mysql!
Warning - this method will remove all of your databases in the /usr/local/var/mysql folder
I had MySQL installed with Homebrew, and the only thing that fixed this for me was re-installing MySQL.
On my company laptop, I didn't have permission to uninstall MySQL from my computer via Homebrew:
$ brew uninstall mysql --ignore-dependencies
Uninstalling /usr/local/Cellar/mysql/8.0.12... (255 files, 233.0MB)
Error: Permission denied # dir_s_rmdir - /usr/local/Cellar/mysql/8.0.12
So instead, I removed and reinstalled MySQL manually:
$ sudo rm -rf /usr/local/Cellar/mysql
$ brew cleanup
$ sudo rm -rf /usr/local/var/mysql
$ brew install mysql
And that worked!
Looks like your mysql server is not started. I usually run the stop command and then start it again:
mysqld stop
mysql.server start
Same error, and this works for me.
Below I'm including the latest instructions from brew install mysql so newer searches for this issue can benefit:
$ brew install mysql
==> Downloading https://homebrew.bintray.com/bottles/mysql-5.6.26.yosemite.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring mysql-5.6.26.yosemite.bottle.1.tar.gz
To connect:
mysql -uroot
To have launchd start mysql at login:
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then to load mysql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Or, if you don't want/need launchctl, you can just run:
mysql.server start
In my case I loaded mysql now via launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist and was then able to launch $ mysql and be on my way.
This problem related to /usr/local/var/mysql folder access, I remove this folder and reinstall mysql.
uninstall mysql with brew :
brew uninstall mysql
sudo rm -r /usr/local/var/mysql
brew install mysql#8.0
mysql -u root
This solution works fine for me!
BUT YOU LOST ALL YOUR DATABASES! WARNING!
This fixed my issue when I restarted the mysql service. Just run:
brew services start mysql
In my case it was simply a matter of deleting a lock file.
sudo rm -f /tmp/mysql.sock.lock
Ough, that took me a while to figure out. I saw it in a comment. After installing mysql using brew, and starting the service (perhaps using sudo brew services start mysql) then run:
$ mysqld
And MySQL should be running for your thereafter.
For me it was simple as running:
/usr/local/opt/mysql/bin/mysqld_safe
instead of mysqld
I went through this issue and I managed to run mysql server using below solution
Install mysql through .dmg(https://dev.mysql.com/downloads/mysql/5.7.html), you will get mysql service panel in system preferences then start mysql from the panel and try
mysql -u root -p
Images attached for reference
just hit "brew services start mysql" in terminal
I found the solution to my problem. It was indeed because my MySQL server was not running.
It was caused by MySQL not being correctly set up on my machine, thus not being able to run.
To remedy this, I used a script which installs MySQL on Mac OSX Mountain Lion, which must have installed missing files.
Here is the link: http://code.macminivault.com/
Important Note: This script sets the root password as a randomly generated string, which it saves on the Desktop, so take care not to delete this file and to note the password. It also installs MySQL manager in your system preferences. I'm also not sure if removes any existing databases, so be careful about that.
After working on this for several hours what worked for me was
go to /etc/mysql/ and edit the my.cnf file. Add the following
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
AFTER USING ALL THE ABOVE SOLUTIONS, NOTHING WORKED FOR ME BUT THIS WORKED.
I you have installed MySQL using HomeBrew then check System Preferences > MySQL in your mac that MySQL Server is stopped if it is running stop it by clicking on Stop MySQL Server and start MySQL from terminal writing the command mysqlserver.start.
If it doesn't work you can also try:-
If you have also installed MySQL workbench then just uninstall MySQL workbench and MySQL and after that install MySQL first and then MySQL workbench.
I would recommend you to run
mysql.server start
before going to
mysql -u root -p
so as to make sure that the mysql server is running before trying to login into it
This happens many times what you start/restart a machine where by no mysql server is running.
I keep coming back to this post, I've encountered this error several times. It might have to do with importing all my databases after doing a fresh install.
I'm using homebrew. The only thing that used to fix it for me:
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
This morning, the issue returned after my machine decided to shut down overnight. The only thing that fixed it now was to upgrade mysql.
brew upgrade mysql
After trying many solutions, seems like the one that finally did the trick was to connect by IP. No longer file sockets getting deleted randomly.
Just update your MySQL client config (e.g. /usr/local/etc/my.cnf) with:
[client]
port = 3306
host=127.0.0.1
protocol=tcp
Probably you might have faced some issues during the homebrew mysql installation and mysql services might not be running. If that is the case, then it might be worth trying below steps to reinstall mysql properly and then try to connect.
sudo chown -R $(whoami) /usr/local/var
sudo chown -R $(whoami) /Library/Caches/Homebrew
brew uninstall mysql
brew install mysql
mysql.server start
mysql -uroot
Homebrew will absolutely never repair the permissions using a standard reinstall, and chasing down which folder/file is corrupted will take longer than it is worth.
In this case - blow away the mysql install manually and reinstall via homebrew. Takes about 2 minutes.
cd /usr/local/var
sudo rm -rf mysql
brew install mysql
Homebrew installs mysql insecure by default, so if you want a password:
mysql_secure_installation
Then fire it up.
mysql -uroot
After installing MySQL on my mac m1 macOS Monterey, using brew install mysql I got this info:
[System] [MY-013169] [Server] /opt/homebrew/Cellar/mysql/8.0.27_1/bin/mysqld (mysqld 8.0.27) initializing of server in progress as process 3624
[ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
[ERROR] [MY-013236] [Server] The designated data directory /opt/homebrew/var/mysql/ is unusable. You can remove all files that the server added to it.
[ERROR] [MY-010119] [Server] Aborting
[System] [MY-010910] [Server] /opt/homebrew/Cellar/mysql/8.0.27_1/bin/mysqld: Shutdown complete (mysqld 8.0.27) Homebrew.
and this warning:
Warning: The post-install step did not complete successfully You can
try again using: brew postinstall mysql
After that I try to start MySQL using brew services start mysql, and I got this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (2)
I managed to fix it using:
> rm -rf ~/opt/homebrew/var/mysql/
> brew postinstall mysql
Now you can connect with mysql -uroot or mysql -uroot -p.
only this has made the trick for me
brew services start --all
(after trying all answers)
I managed to solve this issue by changing localhost to 127.0.0.1
For my case, just specify host as 127.0.0.1, instead of localhost:
$ bin/mysql -uroot -p -h127.0.0.1
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.26
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
if you are using Kali linux you might want to specify the host explicitly
do that with
mysql -h 127.0.0.1 -u root
where 127.0.0.1 is your localhost