LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 09-13-2016, 03:13 PM   #46
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,743

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923

What you see is what is supposed to happen. A server in an nutshell works in the background. The client like mysql talks to the server. What do you want to do?

What happens when you try the command:

mysql -u root
 
Old 09-13-2016, 03:19 PM   #47
zillur
Member
 
Registered: Apr 2015
Posts: 217

Original Poster
Rep: Reputation: Disabled
Code:
[zillur@genomics etc]$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
 
Old 09-13-2016, 03:33 PM   #48
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,743

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923
Code:
your my.cnf
socket=/var/run/mysqld/mysql.sock
Should be
socket=/var/lib/mysql/mysql.sock

If mysqld will not start when using the correct socket then you probably still have a permission problem. Be sure to shutdown and restart.

Last edited by michaelk; 09-13-2016 at 03:35 PM.
 
Old 09-13-2016, 04:21 PM   #49
zillur
Member
 
Registered: Apr 2015
Posts: 217

Original Poster
Rep: Reputation: Disabled
Thank you very much for you comments. After the right socket:

Code:
[zillur@genomics etc]$ systemctl restart mysqld
[zillur@genomics etc]$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Maybe permission problem! What should I do now?

Best Regards
Zillur
 
Old 09-13-2016, 04:34 PM   #50
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by zillur View Post
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)[/CODE]
Maybe permission problem! What should I do now?

Best Regards
Zillur
https://help.ubuntu.com/community/MysqlPasswordReset
 
Old 09-13-2016, 04:48 PM   #51
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,743

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923
You also run the mysql-secure-installation script from a previous post.
 
Old 09-13-2016, 04:55 PM   #52
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Quote:
Originally Posted by michaelk View Post
Code:
your my.cnf
socket=/var/run/mysqld/mysql.sock
Should be
socket=/var/lib/mysql/mysql.sock
I don't totally agree /var/run/mysqld seems a more logical place to put the runtime objects (server pid and socket) required by mysqld

I know you're right, set socket to /var/lib/mysql/mysql.sock is a working solution in this case though

Maybe the socket setting was different in client and server configuration files
(socket set to /var/lib/mysql/mysql.sock in client.cnf)
In my system, client settings would be stored in /etc/my.cnf.d/client.cnf, or in any configuration file under ' [client] ' markup
 
Old 09-13-2016, 04:57 PM   #53
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Quote:
Originally Posted by zillur View Post
Thank you very much for you comments. After the right socket:

Code:
[zillur@genomics etc]$ systemctl restart mysqld
[zillur@genomics etc]$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Maybe permission problem! What should I do now?

Best Regards
Zillur
You need the -p switch and enter mysql root user password
Code:
mysql -u root -p
(enter mysql root password)
 
Old 09-13-2016, 05:04 PM   #54
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by keefaz View Post
You need the -p switch and enter mysql root user password
Thanks. I missed it.
/var/run/mysqld/mysqld.sock on a couple of hosts (servers) I checked.
 
Old 09-13-2016, 05:05 PM   #55
zillur
Member
 
Registered: Apr 2015
Posts: 217

Original Poster
Rep: Reputation: Disabled
Thank you very much. I have done the secure installation.
Code:
[zillur@genomics bin]$ ./mysql_secure_installation 



NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n
 ... skipping.

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] n
 ... skipping.

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!




All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...
Code:
All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...
[zillur@genomics bin]$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[zillur@genomics bin]$
But the problem still persists. What should I do now.

Code:
[zillur@genomics bin]$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[zillur@genomics bin]$ mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[zillur@genomics bin]$ mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Best Regards
Zillur

Last edited by zillur; 09-13-2016 at 05:07 PM.
 
Old 09-13-2016, 05:10 PM   #56
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,743

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923
True, you can specify the socket anywhere as long as the client configuration matches the server. IMO it was easier to go back to the mysql default instead of possibly confusing the OP with additional configurations.

Are you using the correct password? mysql root user is not the same thing as the superuser root.

Last edited by michaelk; 09-13-2016 at 05:13 PM.
 
Old 09-13-2016, 05:12 PM   #57
zillur
Member
 
Registered: Apr 2015
Posts: 217

Original Poster
Rep: Reputation: Disabled
Code:
[zillur@genomics bin]$ mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[zillur@genomics bin]$ mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
 
Old 09-13-2016, 05:18 PM   #58
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,743

Rep: Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923Reputation: 5923
Did you really set a mysql root password?

mysql root user is not the same thing as the superuser root.
 
Old 09-13-2016, 05:22 PM   #59
zillur
Member
 
Registered: Apr 2015
Posts: 217

Original Poster
Rep: Reputation: Disabled
Thank you very much.
Quote:
Did you really set a mysql root password?
How can I be sure that I set the root password for mysql? When I ran secure_installation, I set a password and here using the same password.
Quote:
[zillur@genomics bin]$ ./mysql_secure_installation



NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n
... skipping.
 
Old 09-13-2016, 05:31 PM   #60
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
you entered a password here?
Code:
Enter current password for root (enter for none):
If yes, you entered same password with mysql -u root -p ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ns2.29.3 installation on fedora 15 , nam installation problem Narges Linux - Networking 5 10-31-2011 11:09 AM
PXE installation problem - can only select A series packages for installation Nylex Slackware 4 08-19-2010 02:15 PM
Installation of Binutils(configure:error:installation or configuration problem:C ...) h_r0019 Linux From Scratch 1 05-05-2007 07:40 AM
Redhat/Linux Installation Support??? Is It Red hat installation problem??? wanux Red Hat 1 08-01-2006 10:32 PM
LiLo Installation problem ?and (GNOME and KDE problem) hitesh_linux Linux - Software 1 01-01-2002 04:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration