MySQL won't start in XAMPP Manager-osx - mysql

My XAMPP mysql server is working fine
then I download the separate mysql from oracle and installed it. It is running fine but after some days I cant start it as :> mysql -u root
and in xampp mysql server it is also not working it shows stopped always.
I am providing all the commands that I tried from google as well as StackOverflow
and also I am providing all results of all commands.
Please refer commands before answering.
Number indicates ways that I tried.
1.> `mysql -u root -p`
2.> `mysql -u root`
3.> `sudo su`
3.1.> `ps aux | grep mysql`
3.2.> `kill -9 8306`
4.> `sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start`
5.> `sudo killall mysqld`
6.> Changing content of file as: `innodb_force_recovery = 1` in
`/Applications/XAMPP/xamppfiles/etc/my.cnf`
7.> Changing content of file as: read only permission in
`/Applications/XAMPP/xamppfiles/etc/my.cnf`
8.> Port changed from 3306 to 3307 3308 but nothing is happened
9.> Activity manager : mysql service is. not listed
10.> Reinstalled XAMPP
I followed this 10 ways so please dont answer on this 10 ways
Result of commands :
<.1.
Pratiks-MacBook-Pro:~ pratik$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock' (2 "No such file or directory")
<.2.
Pratiks-MacBook-Pro:~ pratik$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock' (2 "No such file or directory")
<.3.
Pratiks-MacBook-Pro:~ pratik$ sudo su
Password:
sh-3.2# ps aux | grep mysql
root 8306 0.0 0.0 4258468 180 s000 U+ 11:35AM 0:00.00 grep mysql
sh-3.2# kill -9 8306
sh: kill: (8306) - No such process
sh-3.2#
<.4.
Pratiks-MacBook-Pro:~ pratik$ sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
Starting MySQL
.2018-03-13 11:44:29 8513 mysqld_safe Logging to '/Applications/XAMPP/xamppfiles/var/mysql/Pratiks-MacBook-Pro.local.err'.
2018-03-13 11:44:29 8513 mysqld_safe Starting mysqld daemon with databases from /Applications/XAMPP/xamppfiles/var/mysql
ERROR!
<.5.
Pratiks-MacBook-Pro:~ pratik$ sudo killall mysqld
No matching processes were found

Related

Reset the root password in mysql in Ubuntu 18.04 OS

ok here's the thing I tried installing MySQL-server and it did install perfectly no problem there.
later I had had to format my system and then when I tried to install it, it did install but it did not prompt for the root password. when I later tried to reset the root password here's the problem I get
user#user:~$ sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
user#user:~$ sudo mysqld --skip-grant-tables &
[3] 13831
user#user:~$ mysql -u root -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
[3] Exit 1 sudo mysqld --skip-grant-tables
I tried resolving the 2002 error but I am unable to do so. any help will be appreciated.
from what I understand I should not get the 2002 error to proceed further
The error is probably due to error in installation. Try the following:
Ensure that my MySQL service is running by executing the following command in the terminal:
$ sudo service mysql start
Verify the state of the process:
$ ps -A|grep mysql
$ ps -A|grep mysqld
Then kill the process with the following command:
$ sudo pkill mysql
$ sudo pkill mysqld
Finally restart the service:
$ sudo service mysql restart
And run the following command:
$ mysql -u root -p
Step#1: Run this command:
sudo mysql_secure_installation
Step#2: press n
Step#3: input your password.
Step#4: press y for until it says All done!
or follow this video tutorial
Also to change the password use this command:
mysql> ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password';

"ERROR! MySQL server PID file could not be found!", yet a mysqld process is running on port 3306?

I notice that a mysqld process is running on port 3306:
$ sudo lsof -i :3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 63026 _mysql 19u IPv6 0x67fbb37dac8af9c7 0t0 TCP *:mysql (LISTEN)
I would like to stop this process. However, if I try mysql.server stop, I get the following error:
$ mysql.server stop
ERROR! MySQL server PID file could not be found!
I'm on MacOS, by the way. Using sudo, I'm able to find a .pid file:
$ pwd
/usr/local/mysql
$ sudo find . -name '*pid'
./data/mysqld.local.pid
However, I'm not sure whether it's the one expected by the mysql.server stop command.
The problem I'm ultimately trying to solve is that when I try the mysql command, I get the following error:
$ mysql
ERROR 1045 (28000): Access denied for user 'kurtpeek'#'localhost' (using password: NO)
I'm trying to follow the password reset instructions at https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html, but I can't seem to get past the first step, which is to stop the MySQL server. Any help would be much appreciated.
I found a high-level explanation of this problem at https://apple.stackexchange.com/questions/255671/error-mysql-server-pid-file-could-not-be-found. The server has to be stopped using the MySQL Preferences Pane:
Now the sudo lsof -i :3306 command doesn't show any processes running.

Hive error: 'Can't connect to local MySQL server through socket

I installed MySQL Server in CentOS 7:
[root#master1 ~]# rpm -qa | grep mysql
mysql-community-release-el7-5.noarch
mysql-community-server-5.6.39-2.el7.x86_64
mysql-community-common-5.6.39-2.el7.x86_64
mysql-community-client-5.6.39-2.el7.x86_64
mysql-community-libs-5.6.39-2.el7.x86_64
Now I need to execute the following commands:
mysql -u root -p welcome123
CREATE USER 'hive'#'localhost' IDENTIFIED BY 'hivepwd';
However, I get the following error:
[root#master1 ~]# mysql -u root -p welcome123
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
I read the recommendations that it's necessary to check my.cnf but I cannot find this file:
[root#master1 ~]# vi /etc/mysql/my.cnf
[root#master1 ~]# cd /etc/mysql/
-bash: cd: /etc/mysql/: No such file or directory
Finally, I tried to reset the password:
[root#master1 ~]# mysqladmin password newpassword
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
I also tried /usr/bin/mysql_secure_installation. It asks me to enter a root password. So, I generated the password, but it's not accepted and provides the above-shown error.
grep 'A temporary password is generated for root#localhost' /var/log/mysqld.log |tail -1
P.S.
I think that MySQL Server is not actually running:
[root#master1 ~]# ps -ef | grep mysql
root 17964 1 0 17:12 ? 00:00:00 /bin/bash /usr/bin/mysql-systemd-start post
root 20359 14673 0 17:17 pts/0 00:00:00 /usr/bin/perl /usr/bin/mysql_secure_installation
root 21799 14673 0 17:21 pts/0 00:00:00 grep --color=auto mysql
Then I re-install it just in case:
[root#master1 ~]# yum install -y mysql-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.uv.es
* extras: mirror.uv.es
* updates: mirror.uv.es
Package mysql-community-server-5.6.39-2.el7.x86_64 already installed and latest version
Nothing to do
When I want to start the service, it lasts forever:
[root#master1 ~]# systemctl start mysqld.service

MySQL daemon command line login hangs

I have MySQL restarted on Ubuntu (Version 16), and the login command hangs for unknown reasons.
ubuntu#ip-172-31-12-122:~$ sudo /etc/init.d/mysql restart
[ ok ] Restarting mysql (via systemctl): mysql.service.
ubuntu#ip-172-31-12-122:~$
ubuntu#ip-172-31-12-122:~$
ubuntu#ip-172-31-12-122:~$ sudo mysqld -u root -p
It looks like you are starting a new instance of the server in the foreground ?
sudo mysqld -u root -p
https://dev.mysql.com/doc/refman/5.7/en/server-options.html
If you want to login to your running instance
mysql -u root -p
https://dev.mysql.com/doc/refman/5.7/en/mysql.html

Mysql can't connect to local server through socket on Amazon EC2

I opened my application (in Rails) on Amazon EC2 and got an error - thus I checked the logs and there is following:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
10 hours ago was everything working yet. What's the problem? A lot of traffic?
The app is running on Micro Instance.
How to fix this issue and how to avoid it in the future?
Thank you very much
EDIT:
sudo find / -type s
---
/tmp/.sock
/dev/log
/var/lib/apt-xapian-index/update-socket
/run/mysqld/mysqld.sock
/run/acpid.socket
/run/dbus/system_bus_socket
/run/udev/control
find: `/proc/4739/task/4739/fd/5': No such file or directory
find: `/proc/4739/task/4739/fdinfo/5': No such file or directory
find: `/proc/4739/fd/5': No such file or directory
find: `/proc/4739/fdinfo/5': No such file or directory
In my case, the server had apparently restarted at some point, and mysql was not started when it did. I simply typed the command to start and it worked:
sudo service mysqld start
locate your locate my.cnf file see there for line as socket = ../../mysql.sock
you need to replace the path with your path as
socket = /run/mysqld/mysqld.sock
if the path matches let me know
Cross posting my response from here.
I had this same problem on an ec2 instance. These instructions worked perfectly for me:
Redhat Enterprise Linux - RHEL 5 / 6 MySQL installation
Type the following command as root user:
yum install mysql-server mysql
Redhat Enterprise Linux - RHEL 4/3 MySQL installation
Type the following command as root user:
up2date mysql-server mysql
Start MySQL Service
To start the mysql server type the following command:
chkconfig mysqld on
/etc/init.d/mysqld start
Setup the mysql root password
Type the following command to setup a password for root user:
mysqladmin -u root password NEWPASSWORD
Test the mysql connectivity
Type the following command to connect to MySQL server:
$ mysql -u root -p
In my case I used command below:
project_folder > mysql.server start
After system return SUCCESS message it worked OK.
mysql-server is not installed by default on the Amazon Linux AMI. Use these commands to install it:
$ sudo yum install mysql-server
$ sudo chkconfig mysqld on
$ sudo /etc/init.d/mysqld start
$ mysqladmin -u root password NEWPASSWORD
$ mysql -u root -p
To solve this error first find your socket file, run the following commands in terminal
mysqladmin variables | grep socket
For me, this gives:
| socket | /var/run/mysqld/mysqld.sock
Then, add a line to your Rails application: config/database.yml:
development:
adapter: mysql2
host: localhost
username: root
password: xxxx
database: xxxx
socket: /var/run/mysqld/mysqld.sock
This will solve this problem.