LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   MySQL socket error! (https://www.linuxquestions.org/questions/linux-server-73/mysql-socket-error-4175597308/)

TBotNik 01-12-2017 12:15 PM

MySQL socket error!
 
All,

Keep getting the following errors, from MySQL via my server:

Code:

mysqli_connect(): (HY000/2002): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
All these errors started after I installed osticket, via it's HOWTO. Found out that it sets root to it's default password, so have to run a root_reset script, but even that is also giving this error now!

Bash Script root_reset.sh
Code:

#! /bin/bash
# Script to reset ROOT & ADMIN MySQL passwords
# Must be run in the SUDO mode

service mysql stop;
#mysqld --skip-grant-tables < /Scripts/MySQL/root_reset.txt;
mysql --user=mysql < /Scripts/MySQL/root_reset.txt;
service mysql restart;

SQL input file root_reset.txt
Code:

FLUSH PRIVILEGES;
#SET PASSWORD FOR root@'localhost' = PASSWORD('newpass');
#UPDATE mysql.user SET Password=PASSWORD('newpass') WHERE User='root';
USE mysql;
UPDATE user SET Password = PASSWORD('newpass') WHERE Host = 'localhost' AND User = 'root';
UPDATE user SET Password = PASSWORD('newpass') WHERE Host = 'localhost' AND User = $USER;
UPDATE user SET Password = PASSWORD('newpass') WHERE Host = '%' AND User = 'root';
UPDATE user SET Password = PASSWORD('newpass') WHERE Host = '%' AND User = $USER;
FLUSH PRIVILEGES;

#ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
quit;

Help please!

Cheers!

TBNK

szboardstretcher 01-12-2017 03:15 PM

Output of:

Code:

ps auxw | grep mysql
stat /var/run/mysqld/mysqld.sock
cat /var/run/mysqld/mysqld.sock


TBotNik 01-13-2017 01:29 AM

Quote:

Originally Posted by szboardstretcher (Post 5654057)
Output of:

Code:

ps auxw | grep mysql
stat /var/run/mysqld/mysqld.sock
cat /var/run/mysqld/mysqld.sock


szboardstretcher,

No such file as /var/run/mysqld/mysqld.sock or /var/run/mysqld/mysql.sock.

Matter of fact absolutely no .sock file at all on the system.

I'm on Kubuntu 14.04

Cheers!

TBNK

TBotNik 01-14-2017 07:53 AM

Script
 
All,

I have even run the following script in both the install and purge modes, but it does not fix my problem and version remains at 5.5.53.

Code:

#! /bin/bash
# Script to reinstall MySQL completely
# Must be run in the SUDO mode

service mysql stop;

if [ "$1" == "purge*" ]; then
        #Purge method
        echo "Purging MySQL \n";
        apt-get -y -q remove --purge mysql-server mysql-client mysql-common;
        apt-get -y -q remove --purge mysql-client-core-5.5;
        apt-get autoremove && apt-get autoclean;
        rm -rf /var/lib/mysql
        apt-get update && apt-get upgrade;
        sudo apt-get install mysql-server-5.7 mysql-client mysql-common mysql-workbench
else
        echo "Reinstalling MySQL \n";
        apt-get -y -q install --reinstall mysql-server-5.7 mysql-client mysql-common mysql-workbench;
        apt-get autoremove && apt-get autoclean;
        apt-get update && apt-get upgrade;
fi

service mysql start;

Need MySQL back! Was developing and started trying to call MySQL when errors started.

Cheers!

TBNK

TBotNik 01-25-2017 10:07 AM

Weird
 
All,

Im at a weird place with this. I have never been able to actually purge 5.5.53, and so that is what I always get when I run:
Code:

mysql --version
I'm thinking that in addition to my line:
Code:

rm -rf /var/lib/mysql
I also need the line:
Code:

rm -rf /etc/mysql
To make sure nothing there is pointing back to ver 5.5.53

The weird part is, though I never was successful with the upgrade from 5.5.53 to 5.7; I can now login to mysql from the cmd line for both root and $USER and permissions etc are there, but never can login via phpmyadmin anymore. That would suggest issues in/with the config.inc.php config file for phpmyadmin, but can not see any issues there, when editing.

Anyway your comments on these thoughts appreciated. Also I notice all the db files are still in the /var/lib/mysql directory so that also indicates that the "rm" command for that is not working from the script. Wonder if something in those db files, especially the "mysql" database are what keeps making it think its on 5.5.53?

Thanks & Cheers!

TBNK

szboardstretcher 01-25-2017 10:11 AM

Quote:

Wonder if something in those db files, especially the "mysql" database are what keeps making it think its on 5.5.53?
https://dev.mysql.com/doc/internals/...le-format.html

Check out the section on .frm files and the offset 0x33. This is the mysql version the table was built with. You can view it in your files with hexdump if you have it installed.

TBotNik 01-25-2017 10:47 AM

Repository needed
 
All,

The Muon Software Center, as most know is totally useless, so out of frustration installed "Synaptic Package Manager"! Looking in there, the latest available MySQL version is 5.6, so rather obvious why my upgrade is failing.

So knew I needed either new repository or .deb file for this. Found a HOWTO at:

Modified my script to:

Code:

#! /bin/bash
# Script to reinstall MySQL completely
# Must be run in the SUDO mode

service mysql stop;

if [ "$1" == "purge*" ]; then
        #Purge method
        echo "Purging MySQL \n";
        apt-get -y -q remove --purge mysql-server-5.5.53 mysql-server-5.7 mysql-common;
        apt-get -y -q remove --purge mysql-client mysql-client-core-5.5;
        apt-get autoremove && apt-get autoclean;
        tar -zcvf /backups/MySQL/Var/"("$(date +%y-%m-%d)varlibfiles.tar.gz")" /var/lib/mysql;
        rm -rf /var/lib/mysql;
        rm -rf /etc/mysql;
        wget http://dev.mysql.com/get/mysql-apt-config_0.8.0-1_all.deb;
        dpkg -i mysql-apt-config_0.8.0-1_all.deb;
        apt-get update && apt-get upgrade;
        apt-get install mysql-server mysql-client mysql-common mysql-workbench;
        mysql_upgrade;
else
        echo "Reinstalling MySQL \n";
        apt-get -y -q install --reinstall mysql-server-5.7 mysql-client mysql-common mysql-workbench;
        apt-get autoremove && apt-get autoclean;
        apt-get update && apt-get upgrade;
        service mysql start;
fi

Running now to see what results I get!

Cheers!

TBNK

yadheesh 01-27-2017 12:35 AM

Hi,,


Even am also facing the same issue,, for that i use "fuser -k -n tcp 3306"

Use the command and Clear port Issue,, Surely the service ll get restart

TBotNik 02-02-2017 12:29 PM

All,

After trapping the install output an looking at it the following lines in my script:
Code:

        wget http://dev.mysql.com/get/mysql-apt-config_0.8.0-1_all.deb;
        dpkg -i mysql-apt-config_0.8.0-1_all.deb;
        apt-get update && apt-get upgrade;
        apt-get -y -q install mysql-server mysql-client mysql-common mysql-workbench;
        mysql_upgrade;

Always choose version 5.5.56 instead of 5.7, so until I can get the right code to download with the "wget" cmd, then nothing will work right!

Cheers!

TBNK

TBotNik 02-02-2017 03:18 PM

Another
 
All,

Found another HOWTO and changed my code to:

Code:

#! /bin/bash
# Script to reinstall MySQL completely
# Must be run in the SUDO mode

service mysql stop;
fuser -k -n tcp 3306;

if [ "$1" == "purge*" ]; then
        #Purge method
        echo "Purging MySQL! \n";
        apt-get -y -q remove --purge mysql-server-5.5.53 mysql-server-5.7 mysql-common;
        apt-get -y -q remove --purge mysql-client mysql-client-core-5.5;
        apt-get autoremove && apt-get autoclean;
        tar -zcvf /backups/MySQL/Var/"("$(date +%y-%m-%d)varlibfiles.tar.gz")" /var/lib/mysql;
        rm -rf /var/lib/mysql;
        rm -rf /etc/mysql;
       
        echo "Installing MySQL 5.7! \n";
        # wget http://dev.mysql.com/get/mysql-apt-config_0.8.0-1_all.deb;
        wget http://dev.mysql.com/get/mysql-apt-config_0.3.2-1ubuntu14.04_all.deb;
        # dpkg -i mysql-apt-config_0.8.0-1_all.deb;
        dpkg -i mysql-apt-config_0.3.2-1ubuntu14.04_all.deb;
        apt-get -y -q update && apt-get -y -q upgrade;
        # apt-get -y -q install mysql-server mysql-client mysql-common mysql-workbench;
        apt-get -y -q install mysql-server-5.7 mysql-client mysql-common mysql-workbench;
        mysql_upgrade -u root -pnomened1497 --force;
else
        echo "Reinstalling MySQL \n";
        apt-get -y -q install --reinstall mysql-server-5.7 mysql-client mysql-common mysql-workbench;
        apt-get autoremove && apt-get autoclean;
        apt-get update && apt-get upgrade;
        service mysql start;
fi

But none of these have a repository so the line:

Code:

apt-get -y -q install mysql-server-5.7 mysql-client mysql-common mysql-workbench;
Keeps erroring with the message:

Quote:

E: Unable to locate package mysql-server-5.7
E: Couldn't find any package by regex 'mysql-server-5.7'
So without an actual repository entry in the "/etc/apt/sources.list" file this will never install.

Still looking for that. If you know it or have it please share!

Cheers!

TBNK

TBotNik 02-02-2017 04:40 PM

DPKG Fails
 
All,

Additionally the 5.7 resource that the dpkg install is looking for, no longer exists, so the dpkg screen opens, but hangs, because the resource can not be found. My Magento says I need 5.7, so really have to get this installed.

However, I'm running the upgrade from 5.5.53 to 5.6, through synaptic package manager, but even that is erroring, so not sure what to do next!

Cheers!

TBNK

TBotNik 02-04-2017 05:43 PM

Works on new install
 
All,

OK! Had to do new Kubuntu 14.04 LTS install on my laptop, due to it dying all the time.

See: http://www.linuxquestions.org/questi...ts-4175596797/

When this come to the mysql install, the dpkg, though totally written wrong (keeps you in a loop, till you figure out what it's looking for), infact does have and installs MySQL 5.7, from the native ubuntu repositories.

I called it with the code:

Code:

        echo " ";
        echo "Getting MySQL 5.7 source!";
        wget http://dev.mysql.com/get/mysql-apt-config_0.8.0-1_all.deb;
        echo " ";
        echo "Installing MySQL 5.7!";
        dpkg -i mysql-apt-config_0.8.0-1_all.deb;
        apt-get -y -q update && apt-get -y -q upgrade;
        apt-get -y -q install mysql-server mysql-client mysql-common mysql-workbench;
        mysql_upgrade -u root -pyouradminpwd --force;

Retrying this again on the server. Let you know how it goes.


All times are GMT -5. The time now is 03:39 PM.