LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-15-2020, 10:57 AM   #1
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Rep: Reputation: Disabled
MySQL not working


All,

I hate MySQL issues, none of the HOWTOs ever get close to solving your problems. So on the New Server (old server but upgraded to 18.04 LTS) I get MySQL install, but nothing works because there are 20 users that have to be create.

I have the users and their "CREATE" statements in a .sql file and normally you run the cmd:

Code:
mysql -u root -p < myuserfile.sql
And it's done!

But no nothing but errrors and working on this for over 24 hrs, find this HOWTO at:

So I run it! Now cannot even login to MySQL and getting errors:

Quote:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
This is why I hate NySQL errors as non of the HOWTOs work! They always make the proble worse!

Need some real help here!

TBNK
 
Old 07-15-2020, 10:58 AM   #2
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
Do I need to purge MySQL and re-install?
 
Old 07-15-2020, 11:25 AM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,732

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
I tend to go to the source for MySQL documentation.

I'm also kinda lazy, so I use phpMyAdmin a lot to figure out sql syntax if I'm having a problem, 'tho of course I have to write actual sql when using it in a program.

It would be helpful to know what version of mysql you're running...
How you installed it.
What errors you're getting.

It's been awhile since I set up a new server, but my recollection is that the mysql root account on a new installation doesn't have a password.
 
Old 07-16-2020, 01:27 PM   #4
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
I tend to go to the source for MySQL documentation.

I'm also kinda lazy, so I use phpMyAdmin a lot to figure out sql syntax if I'm having a problem, 'tho of course I have to write actual sql when using it in a program.

It would be helpful to know what version of mysql you're running...
How you installed it.
What errors you're getting.

It's been awhile since I set up a new server, but my recollection is that the mysql root account on a new installation doesn't have a password.
scasey,

Hey Buddy! Posted the errors! Started out that I just could not login to PHPmyAdmin, but then when I followed that HOWTO totally screwed it all up!

Just to make it EZ gonna purge and re-install MySQL. Remember from before having to manually edit/update the mysql.ini and a conf file for PHP, but forgot that. The PHPmyAdmin config file config.inc.php always has to be updated as session timeouts and other parms are always missing in the default file and then the MySQL user and pwd also have to be set there.

Cheers!

TBNK
 
Old 07-16-2020, 03:59 PM   #5
Steve R.
Member
 
Registered: Jun 2009
Location: Morehead City, NC
Distribution: Mint 20.3
Posts: 521

Rep: Reputation: 98
After several years of MySQL then MariaDB working without issue, I upgraded to Linux Mint 19.3 the installation of MariaDB failed miserably. I just upgraded to Mint 20, and the reinstall of MariaDB went flawless.

Before going further.
1. Kubuntu 20.04 was released in April. So why not upgrade directly to that version?
2. You mention having 20 users. For starters, just get one user working.
3. When you do an internet help search on installing MySQL you will be getting a lot of old posts/tutorials that are out of date. Look at the posting date and also the distribution that post/tutorial applies to.
4. The login authentication method for both MariaDB/Mysql have been changed. You need to be aware of using "auth_socket" and "mysql_native_password"

Take a look at the following links:
How to Install MySQL on Ubuntu 20.04
Linuxize: How to Install MariaDB on Ubuntu 20.04
digitalocean: How To Install MariaDB on Ubuntu 20.04
How To Install MariaDB 10.5 on Ubuntu 20.04 (Focal Fossa)
How to Install phpMyAdmin with Apache (LAMP) on Ubuntu 20.04

As a quick overview follow all the steps to install the database except for doing "mysql_secure_installation". Additionally do not create a root password at this time.

With your first login to MySQL create a new user and grant that user all permissions. Go ahead and install PHPMyAdmin. However, when logging into PHPMyAdmin, login as the new user you just created in MySQL. While in PHPMyAdmin go to the root account and assign root a password.

I hope that these suggestions are useful to you.

Last edited by Steve R.; 07-16-2020 at 04:50 PM.
 
Old 07-19-2020, 01:48 PM   #6
dmchess
Member
 
Registered: Jan 2005
Posts: 244

Rep: Reputation: 43
On my current MariaDB, I have use sudo when signing in with Admin rights.

myuser@myserver:~$ sudo mysql -u root
[sudo] password for myuser:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 72
Server version: 10.1.44-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
I then created a general password to do my work and only use root to define databases and tables.

MariaDB [(none)]
>

No password is required except Linux OS Password, maybe your system requires a similar means of access.

Last edited by dmchess; 07-19-2020 at 01:50 PM.
 
Old 07-19-2020, 02:41 PM   #7
agillator
Member
 
Registered: Aug 2016
Distribution: Mint 19.1
Posts: 419

Rep: Reputation: Disabled
Recent installations of mariadb (at least from version 10.3 on, perhaps 10.1 on) login is via unix-socket, not password. This means the login will be by the current user and no password will be required since a password was required to log in to the system as that user. The mariadb folks apparently feel that is more secure. It is possible to go back to password login but that is not the issue here. To log in as the current user simply
Code:
mysql
To log in as another user, including root
Code:
sudo <username> mysql
This assumes sudo permission of course, else su to the user and login.
 
Old 07-20-2020, 03:04 PM   #8
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
All,

OK! Ran: apt purge mysql, then new install but still locked out. Pretty sure there are files needing to delete after the purge that are still having be locked out of it.

Cheers!

TBNK
 
Old 07-20-2020, 03:11 PM   #9
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dmchess View Post
On my current MariaDB, I have use sudo when signing in with Admin rights.

myuser@myserver:~$ sudo mysql -u root
[sudo] password for myuser:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 72
Server version: 10.1.44-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
I then created a general password to do my work and only use root to define databases and tables.

MariaDB [(none)]
>

No password is required except Linux OS Password, maybe your system requires a similar means of access.
dmchess,

The issue is that any attempt to login to mysql always says:

Quote:
mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
or
Quote:
mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
And both used to work before I followed that HOWTO to fix the fact the "ROOT" had no permissions to change anything!

Cheers!

TBNK

Last edited by TBotNik; 07-20-2020 at 03:14 PM.
 
Old 07-20-2020, 04:00 PM   #10
Steve R.
Member
 
Registered: Jun 2009
Location: Morehead City, NC
Distribution: Mint 20.3
Posts: 521

Rep: Reputation: 98
@TBotNik: Go back to my earlier post. If you have PHPMyAdmin running and can login as another user that has full grant database privileges, see if you can assign a root password under PHPMyAdmin.

Do you have a "second" user with full grant privileges to MySQL?
 
Old 07-20-2020, 07:15 PM   #11
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,732

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Did you try using sudo as dmchess suggested?
 
Old 12-14-2020, 10:04 AM   #12
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
All,

I finally have MySQL working! I wrote a BASH script to completely purge it, then re-installed it, then used some .sql files to create all needed users with permissions and finally added the missing DB and table create .sql files from the backups.

Still having issues with Apache and PHPmyAdmin, so still not in full control, but already have a thread open on this board for the Apache issues.

Cannot see MySQL in phpmyadmin, but working perfectly in MySQLworkbench!

Cheers!

TBNK

Last edited by TBotNik; 12-14-2020 at 10:06 AM.
 
Old 12-14-2020, 10:25 AM   #13
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
Marking this solved!

If you need the scripts used for purging email me!

Cheers!

TBNK
 
Old 12-15-2020, 03:59 AM   #14
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,141

Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
If I may suggest this time make regular backups of your setup. Linking my script from git so you can use it as a template if you wish. This makes new installs or whatever a breeze. Simple import.

https://github.com/jmgibson1981/scri...kups.sh.source

Sql function of course. It's built for my Docker usage but the general idea should be the same. Requires a dedicated user with privileges enough to dump the whole of all dbs.
 
Old 12-16-2020, 12:33 AM   #15
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
jmgobson1981, thank you for sharing your script, but please keep in mind that this user you have chosen to help has several web pages with false or nonsensical IT "qualifications" to lure in trusting customers, and also tells lies here on LQ.

I wrote about this before but can't find it right now.

Example.
 
  


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
Can MySQL log on via SSH/bash? mysql:x:27:101:MySQL Server:/var/lib/mysql:/bin/bash Ujjain Linux - Newbie 2 04-24-2009 02:21 PM
yum install php-mysql fails with mysql 5.1 - "Error: mysql conflicts with MySQL" rebelde Linux - Software 2 03-13-2009 10:32 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Newbie 1 06-23-2007 03:35 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:13 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