Xampp: cannot connect to mysql from terminal
up vote
1
down vote
favorite
I added export PATH=$PATH:/opt/lampp/bin/
to my ~/.zshrc
file. I can access php but whenever I type sudo mysql -uroot
I see the following message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I can however, access mysql by defining full path like this: sudo /opt/lampp/bin/mysql -uroot
. But I don't want that... I mean I would have to type the full path everytime or create an alias or symlink.
I am on Ubuntu 16.04 and using zshell.
mysql xampp
add a comment |Â
up vote
1
down vote
favorite
I added export PATH=$PATH:/opt/lampp/bin/
to my ~/.zshrc
file. I can access php but whenever I type sudo mysql -uroot
I see the following message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I can however, access mysql by defining full path like this: sudo /opt/lampp/bin/mysql -uroot
. But I don't want that... I mean I would have to type the full path everytime or create an alias or symlink.
I am on Ubuntu 16.04 and using zshell.
mysql xampp
1
Any particular reason to run XAMPP and not our native version? Ours is tailored to Ubuntu works out of the box and has lots more documentation. Plus the owner of XAMPP himself admitted that it is not fit for serious usage.
â Rinzwind
Feb 1 at 8:29
sudo
uses its ownsecure_path
rather than the invoking user's path. Do you really need to run mysql as root (as opposed to logging in to it with the mysql root user)?
â steeldriver
Feb 1 at 11:07
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I added export PATH=$PATH:/opt/lampp/bin/
to my ~/.zshrc
file. I can access php but whenever I type sudo mysql -uroot
I see the following message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I can however, access mysql by defining full path like this: sudo /opt/lampp/bin/mysql -uroot
. But I don't want that... I mean I would have to type the full path everytime or create an alias or symlink.
I am on Ubuntu 16.04 and using zshell.
mysql xampp
I added export PATH=$PATH:/opt/lampp/bin/
to my ~/.zshrc
file. I can access php but whenever I type sudo mysql -uroot
I see the following message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I can however, access mysql by defining full path like this: sudo /opt/lampp/bin/mysql -uroot
. But I don't want that... I mean I would have to type the full path everytime or create an alias or symlink.
I am on Ubuntu 16.04 and using zshell.
mysql xampp
mysql xampp
asked Feb 1 at 6:09
Eisenheim
2192310
2192310
1
Any particular reason to run XAMPP and not our native version? Ours is tailored to Ubuntu works out of the box and has lots more documentation. Plus the owner of XAMPP himself admitted that it is not fit for serious usage.
â Rinzwind
Feb 1 at 8:29
sudo
uses its ownsecure_path
rather than the invoking user's path. Do you really need to run mysql as root (as opposed to logging in to it with the mysql root user)?
â steeldriver
Feb 1 at 11:07
add a comment |Â
1
Any particular reason to run XAMPP and not our native version? Ours is tailored to Ubuntu works out of the box and has lots more documentation. Plus the owner of XAMPP himself admitted that it is not fit for serious usage.
â Rinzwind
Feb 1 at 8:29
sudo
uses its ownsecure_path
rather than the invoking user's path. Do you really need to run mysql as root (as opposed to logging in to it with the mysql root user)?
â steeldriver
Feb 1 at 11:07
1
1
Any particular reason to run XAMPP and not our native version? Ours is tailored to Ubuntu works out of the box and has lots more documentation. Plus the owner of XAMPP himself admitted that it is not fit for serious usage.
â Rinzwind
Feb 1 at 8:29
Any particular reason to run XAMPP and not our native version? Ours is tailored to Ubuntu works out of the box and has lots more documentation. Plus the owner of XAMPP himself admitted that it is not fit for serious usage.
â Rinzwind
Feb 1 at 8:29
sudo
uses its own secure_path
rather than the invoking user's path. Do you really need to run mysql as root (as opposed to logging in to it with the mysql root user)?â steeldriver
Feb 1 at 11:07
sudo
uses its own secure_path
rather than the invoking user's path. Do you really need to run mysql as root (as opposed to logging in to it with the mysql root user)?â steeldriver
Feb 1 at 11:07
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
You have two versions of mysql installed - one from Ubuntu repositories and one from some third party location. When you use the Ubuntu version, located in /usr/bin/mysql
it attempt to connect trough a socket in the default location, /var/run/mysqld/mysqld.sock
, which does not work, because the server running is not the Ubuntu stock mysql-server.
It works when you run /opt/lampp/bin/mysql -uroot
(no reason to run that as root, by the way), because this mysql binary has default path set to where the actual socket is.
You have three alternatives:
- Modify your path so that
/opt/lampp/bin/ is before
/usr/bin/` in path. This will execute the lampp version of mysql before the Ubuntu version. - Uninstall Ubuntu mysql client with
sudo apt-get remove mysql-client
. This may break other packages. - Uninstall lampp and install the required packages from Ubuntu.
#3 would be my preferred solution. Getting all the software from the repositories ensures that it will be kept up to date, be (mostly) compatible, and have a clear, well defined upgrade path to the next Ubuntu Release.
Apache, PHP, Mysql/MariaDB and a lot of apache modules are available in the Ubuntu repositories.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
You have two versions of mysql installed - one from Ubuntu repositories and one from some third party location. When you use the Ubuntu version, located in /usr/bin/mysql
it attempt to connect trough a socket in the default location, /var/run/mysqld/mysqld.sock
, which does not work, because the server running is not the Ubuntu stock mysql-server.
It works when you run /opt/lampp/bin/mysql -uroot
(no reason to run that as root, by the way), because this mysql binary has default path set to where the actual socket is.
You have three alternatives:
- Modify your path so that
/opt/lampp/bin/ is before
/usr/bin/` in path. This will execute the lampp version of mysql before the Ubuntu version. - Uninstall Ubuntu mysql client with
sudo apt-get remove mysql-client
. This may break other packages. - Uninstall lampp and install the required packages from Ubuntu.
#3 would be my preferred solution. Getting all the software from the repositories ensures that it will be kept up to date, be (mostly) compatible, and have a clear, well defined upgrade path to the next Ubuntu Release.
Apache, PHP, Mysql/MariaDB and a lot of apache modules are available in the Ubuntu repositories.
add a comment |Â
up vote
1
down vote
You have two versions of mysql installed - one from Ubuntu repositories and one from some third party location. When you use the Ubuntu version, located in /usr/bin/mysql
it attempt to connect trough a socket in the default location, /var/run/mysqld/mysqld.sock
, which does not work, because the server running is not the Ubuntu stock mysql-server.
It works when you run /opt/lampp/bin/mysql -uroot
(no reason to run that as root, by the way), because this mysql binary has default path set to where the actual socket is.
You have three alternatives:
- Modify your path so that
/opt/lampp/bin/ is before
/usr/bin/` in path. This will execute the lampp version of mysql before the Ubuntu version. - Uninstall Ubuntu mysql client with
sudo apt-get remove mysql-client
. This may break other packages. - Uninstall lampp and install the required packages from Ubuntu.
#3 would be my preferred solution. Getting all the software from the repositories ensures that it will be kept up to date, be (mostly) compatible, and have a clear, well defined upgrade path to the next Ubuntu Release.
Apache, PHP, Mysql/MariaDB and a lot of apache modules are available in the Ubuntu repositories.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
You have two versions of mysql installed - one from Ubuntu repositories and one from some third party location. When you use the Ubuntu version, located in /usr/bin/mysql
it attempt to connect trough a socket in the default location, /var/run/mysqld/mysqld.sock
, which does not work, because the server running is not the Ubuntu stock mysql-server.
It works when you run /opt/lampp/bin/mysql -uroot
(no reason to run that as root, by the way), because this mysql binary has default path set to where the actual socket is.
You have three alternatives:
- Modify your path so that
/opt/lampp/bin/ is before
/usr/bin/` in path. This will execute the lampp version of mysql before the Ubuntu version. - Uninstall Ubuntu mysql client with
sudo apt-get remove mysql-client
. This may break other packages. - Uninstall lampp and install the required packages from Ubuntu.
#3 would be my preferred solution. Getting all the software from the repositories ensures that it will be kept up to date, be (mostly) compatible, and have a clear, well defined upgrade path to the next Ubuntu Release.
Apache, PHP, Mysql/MariaDB and a lot of apache modules are available in the Ubuntu repositories.
You have two versions of mysql installed - one from Ubuntu repositories and one from some third party location. When you use the Ubuntu version, located in /usr/bin/mysql
it attempt to connect trough a socket in the default location, /var/run/mysqld/mysqld.sock
, which does not work, because the server running is not the Ubuntu stock mysql-server.
It works when you run /opt/lampp/bin/mysql -uroot
(no reason to run that as root, by the way), because this mysql binary has default path set to where the actual socket is.
You have three alternatives:
- Modify your path so that
/opt/lampp/bin/ is before
/usr/bin/` in path. This will execute the lampp version of mysql before the Ubuntu version. - Uninstall Ubuntu mysql client with
sudo apt-get remove mysql-client
. This may break other packages. - Uninstall lampp and install the required packages from Ubuntu.
#3 would be my preferred solution. Getting all the software from the repositories ensures that it will be kept up to date, be (mostly) compatible, and have a clear, well defined upgrade path to the next Ubuntu Release.
Apache, PHP, Mysql/MariaDB and a lot of apache modules are available in the Ubuntu repositories.
answered Feb 1 at 7:46
vidarlo
7,26642140
7,26642140
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1001962%2fxampp-cannot-connect-to-mysql-from-terminal%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Any particular reason to run XAMPP and not our native version? Ours is tailored to Ubuntu works out of the box and has lots more documentation. Plus the owner of XAMPP himself admitted that it is not fit for serious usage.
â Rinzwind
Feb 1 at 8:29
sudo
uses its ownsecure_path
rather than the invoking user's path. Do you really need to run mysql as root (as opposed to logging in to it with the mysql root user)?â steeldriver
Feb 1 at 11:07