Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Ubuntu systems with mysql installed have a special mysql user for update purposes that you can use to login and do maintenance.
With the mysql daemon running, in a terminal
Code:
mysql -u debian-sys-maint -p
In another terminal, 'cat' the file /etc/mysql/debian.cnf. That file contains the password for the debian-sys-masint user; paste that password when prompted for it.
You should now have gained access and this user has the same privileges as the root user.
Assuming the mysql root user is still existing, you can set a password using
Code:
update user set password=password('yourpassword') where user='root'
If the mysql root user no longer exists, use below to create the account
Code:
grant all privileges on *.* to 'root'@'localhost' identified by 'yourpassword' with grant option
Don't forget to flush the privileges before quiting the client.
PS
Not sure how much damage has been done by now, but above would work on a 'normal' install.
Last edited by Wim Sturkenboom; 09-03-2012 at 08:49 PM.
Ubuntu systems with mysql installed have a special mysql user for update purposes that you can use to login and do maintenance.
With the mysql daemon running, in a terminal
Code:
mysql -u debian-sys-maint -p
In another terminal, 'cat' the file /etc/mysql/debian.cnf. That file contains the password for the debian-sys-masint user; paste that password when prompted for it.
You should now have gained access and this user has the same privileges as the root user.
Assuming the mysql root user is still existing, you can set a password using
Code:
update user set password=password('yourpassword') where user='root'
If the mysql root user no longer exists, use below to create the account
Code:
grant all privileges on *.* to 'root'@'localhost' identified by 'yourpassword' with grant option
Don't forget to flush the privileges before quiting the client.
PS
Not sure how much damage has been done by now, but above would work on a 'normal' install.
When I run "mysql -u debian-sys-maint -p" I get "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)"
Alas, we have a problem on the earlier step. When I run "service mysql start", I get "start: Job failed to start"
Does /var/log/mysql.err or /var/log/mysql.log indicate what the problem could be? It may be that another process is listening on the socket. If so we'll need to kill it.
Code:
netstat -nlp | grep 3306
#you should see something like the following line.
#tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1456/mysqld
#Let's kill the process using it's pid (process ID).
kill -15 1456
#run the netstat command again, if the process does not go away after a while of running the netstat command then issue a force kill.
kill -9 1456
#try starting the mysql service again
service mysql start
Does /var/log/mysql.err or /var/log/mysql.log indicate what the problem could be? It may be that another process is listening on the socket. If so we'll need to kill it.
Code:
netstat -nlp | grep 3306
#you should see something like the following line.
#tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1456/mysqld
#Let's kill the process using it's pid (process ID).
kill -15 1456
#run the netstat command again, if the process does not go away after a while of running the netstat command then issue a force kill.
kill -9 1456
#try starting the mysql service again
service mysql start
Opening mysql.err and mysql.log in vim reveals empty files.
When I run "mysql -u debian-sys-maint -p" I get "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)"
Your daemon is not running; the netstat command also shows that.
Yes, hopefully with that everything should be okay. You might need to start the server,
Code:
sudo service mysql start
Sigh, and we're back to "start: Job failed to start".
In case I'm missing something, the return from "sudo apt-get install mysql-server" was:
Quote:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
mysql-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/11.7 kB of archives.
After this operation, 115 kB of additional disk space will be used.
Selecting previously unselected package mysql-server.
(Reading database ... 285829 files and directories currently installed.)
Unpacking mysql-server (from .../mysql-server_5.5.24-0ubuntu0.12.04.1_all.deb) ...
Setting up mysql-server (5.5.24-0ubuntu0.12.04.1) ...
root@jane:/var/log#
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.