why apache2 server and mysql is not starting in XAMPP? - mysql

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

Related

How to install 'systemctl' on Ubuntu (docker)?

I have a docker with Ubuntu 16.04 and trying to install mysql-server in it.
Installation went fine (apt-get install -y mysql-server) and now is time to run a server:
systemctl status mysql
Failed to connect to bus: No such file or directory
How to find/install systemctl for Ubuntu 16.04 (docker) and are there alternatives?
Systemd is not installed on the ubuntu docker image. You can use the "service" command
service mysql start
service mysql status
You can also use the mysql docker image instead of installing mysql manually on ubuntu.
Ubuntu 16.04 is based on systemd, and systemctl tries to contact the daemon via d-bus. There are a number of solutions to solve this problem, one may be docker-systemctl-replacement.

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

xampp could not be started in ubuntu 12.04?

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

How to stop mysqld

To find out the start command for mysqld (using a mac) I can do:
ps aux|grep mysql
I get the following output, which allows me to start mysql server.
/usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=...
How would I find the necessary command to stop mysql from the command line?
Try:
/usr/local/mysql/bin/mysqladmin -u root -p shutdown
Or:
sudo mysqld stop
Or:
sudo /usr/local/mysql/bin/mysqld stop
Or:
sudo mysql.server stop
If you install the Launchctl in OSX you can try:
MacPorts
sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mysql.plist
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql.plist
Note: this is persistent after reboot.
Homebrew
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Binary installer
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart
I found that in: https://stackoverflow.com/a/102094/58768
There is an alternative way of just killing the daemon process by calling
kill -TERM PID
where PID is the value stored in the file mysqld.pid or the mysqld process id which can be obtained by issuing the command ps -a | grep mysqld.
I did it with next command:
sudo killall mysqld
I found the answer here.
Use
sudo stop mysql
For Windows, you can run this command directly if mysql/bin is in your path.
mysqladmin -u root -p shutdown
Worked for me on mac
a) Stop the process
sudo launchctl list | grep -i mysql
If the result shows anything like: "xxx.xxx.mysqlxxx"
sudo launchctl remove xxx.xxx.mysqlxxx
Example:
sudo launchctl remove org.macports.mysql56-server
b) Disable to autostart the process
sudo launchctl unload -wF /Library/LaunchDaemons/xxx.xxx.mysqlxxx.plist
Example:
sudo launchctl unload -wF /Library/LaunchDaemons/org.macports.mysql56-server.plist
Finally reboot your mac
Note: In some cases if you tried "a)" first, you need to reboot again before try b).
When mysql was installed with Homebrew, it automatically restarts when killed. You need to use the following command:
brew services stop mysql
PS: If you installed a specific version, it will be mysql#X.X
On OSX 10.8 and on, the control for MySQL is available from the System Configs. Open System Preferences, click on Mysql (usually on the very bottom) and start/stop the service from that pane. https://dev.mysql.com/doc/refman/5.6/en/osx-installation-launchd.html
The plist file is now under /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
for Binary installer use this:
to stop:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
to start:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
to restart:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart
Try killing mysqld four times in a row. It's the only thing that worked for me...
root#ubuntu:/etc/init# killall -KILL mysqld
root#ubuntu:/etc/init# killall -KILL mysqld
root#ubuntu:/etc/init# killall -KILL mysqld
root#ubuntu:/etc/init# killall -KILL mysqld
mysqld: no process found
Just keep killing it over and over until you see "mysqld: no process found".
Kill is definitly the wrong way! The PID will stay, Replicationsjobs will be killed etc. etc.
STOP MySQL Server
/sbin/service mysql stop
START MySQL Server
/sbin/service mysql start
RESTART MySQL Server
/sbin/service mysql restart
Perhaps sudo will be needed if you have not enough rights
What worked for me on CentOS 6.4 was running service mysqld stop as the root user.
I found my answer on nixCraft.
/etc/init.d/mysql stop
service mysql stop
killall -KILL mysql mysqld_safe mysqld
When you see the following information, you success
mysql: no process found
mysqld_safe: no process found
mysqld: no process found
I use this to solve the installation problem of MySQL 5.6 in Ubuntu 15.10 using this link.
During this installation, I encounter the problem saying:
"mysqld_safe A mysqld process already exists"
Just completely stop the mysqld, mysqld_safe, mysql solves the problem.
If my mysql keeps restarting
sudo rm -rf /usr/local/var/mysql/dev.work.err
mysql.server stop
worked for me.
To stop autostart of mysql on boot, the following worked for me with mysql 8.0.12 installed using Homebrew in macOS Mojave 10.14.1:
rm -rf ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
To stop MariaDB and MySQL server instance:
sudo mysqladmin shutdown
To start MariaDB and MySQL server instance:
mysqld &
To change data ownership for MariaDB and MySQL server instance:
sudo chown -R 755 /usr/local/mariadb/data
Just go to task manager.
Then in process, search mysqld.
right click on mysqld then click on stop.
with this process you can stop it without using commands.
first try this
sudo service apache2 stop
if not, then
sudo mysql stop
if not, then
sudo stop mysql
if not, then
sudo mysqladmin shutdown
I have been there, and I do with many tips, at the end of using tips that I follow will lead me to solved. So if you not solve in this issue, you just do other tips, till your issue get solved. Hopefully it's will help you. Thanks
For mysql 5.7 downloaded from binary file onto MacOS:
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
Following worked for me on my macbook pro:
brew services stop mysql
Incase if you want to stop all brew services:
brew services stop --all
if all else fails, this help me. Every time I tried to kill the process with the last installation it will respawn.
sudo rm -rf /usr/local/var/mysql
brew reinstall mysql
For MAMP
Stop servers (but you may notice MySQL stays on)
Remove or rename /Applications/MAMP/tmp/mysql/ which holds the mysql.pid and mysql.sock.lock files
When you go back to Mamp, you'll see MySQL is now off. You can "Start Servers" again.

How make mysql start automatically ? (linux-cli only)

How can i make mysql start every time the system boot ? I need that in a dedicated server(ubuntu distro) in which i have my blog, but every time the server goes down, on booting mysql is stopped.
Btw i can use only command line.
update-rc.d allows setting init script links on Ubuntu and Debian Linux systems to control what services are run by init when entering various runlevels. It should be able to add mysql to the list of services to run at boot:
sudo update-rc.d mysql defaults
If you later want to disable running mysql on bootup:
sudo update-rc.d mysql remove
You can do it by using sysv-rc-conf, on debian based you can install it with sudo apt-get install sysv-rc-conf
then you can choose what start at boot with a simple X on the name of the deamon, all via command line
Run the following command to see your mysql current status:
/sbin/chkconfig mysqld --list
it will return a line such as below:
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
to make mysql start every time the system boots, type the following:
sudo /sbin/chkconfig mysqld on
Result now from '--list' is:
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
No answer helped. Finally chkconfig and update-rc.d did not work with MySQL on my machine.
Solution, I had a file /etc/init/mysql.override which contained
manual
i just deleted that file
$ sudo rm /etc/init/mysql.override
Deleting
/etc/init/mysql.override
did the job in my case (HostEurope VPS with Ubuntu 12.04)
I had the same problem, so I checked how I disabled it in the first place:
https://askubuntu.com/questions/138487/how-to-keep-apache-and-mysql-from-starting-automatically
Check your /etc/init/mysql.conf to make sure you don't have start on commented out (like I did).
# MySQL Service
description "MySQL Server"
author "Mario Limonciello <superm1#ubuntu.com>"
start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]
...
Rebooted the machine and it works.
$ sudo service mysql status
mysql start/running, process 972
Use the chkconfig command as per the manpage http://manpages.ubuntu.com/manpages/maverick/man8/chkconfig.8.html
Another place to look for clues as to what is and isn't starting at boot time...
/etc/init.d/.depend.start (and its buddy at shutdown time, .depend.stop)
Here's a little more info http://www.pyenet.co.nz/2-202-1-customising-system-startup-and-boot-processes/
I had 2 servers - after booting, 1 would have mysql running, the other not so much.
On the box where mysql was starting at boot time:
chkconfig wasn't even installed
there were zero links from any scripts in /etc/rc?.d/* back to /etc/init.d/mysql
BUT... /etc/init.d/.depend.start contained:
TARGETS = halt apache2 umountfs umountnfs.sh sendsigs networking umountroot reboot killprocs unattended-upgrades urandom mysql mdadm dns-clean landscape-client pppd-dns sysstat rsync sudo postfix single grub-common ondemand rc.local
INTERACTIVE = apache2
postfix: mysql
single: killprocs dns-clean pppd-dns
grub-common: apache2 unattended-upgrades postfix mysql mdadm dns-clean landscape-client pppd-dns sysstat rsync sudo
ondemand: apache2 unattended-upgrades postfix mysql mdadm dns-clean landscape-client pppd-dns sysstat rsync sudo
rc.local: apache2 unattended-upgrades postfix mysql mdadm dns-clean landscape-client pppd-dns sysstat rsync sudo
When I simply copied this file over to the problem server, and rebooted, mysql was up & running.
With Debian 9, I installed MySQL today and typed "reboot" and mysqld restarted automatically. Also rebooted from my VPS dashboard, mysqld restarted automatically. In short, if you have Debian 9, there's nothing extra to do, it just works.