Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7035459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:18:24+00:00 2026-05-28T01:18:24+00:00

I’m writing a script to perform some database maintenance, and MySQL is not accepting

  • 0

I’m writing a script to perform some database maintenance, and MySQL is not accepting the username I’m trying to pass it.

I have a MySQL user and database named ‘abc_wpsites’, as well as a user and database named ‘abc_wpsitesdev’. Here, I’m trying to access abc_wpsitesdev, but MySQL continually attempts to access with the account ‘abc_wpsites’ instead.

abc.com [~]# mysql -uabc_wpsitesdev --password='(redacted)' -h localhost abc_wpsitesdev
ERROR 1045 (28000): Access denied for user 'abc_wpsites'@'localhost' (using password: YES)
abc.com [~]# mysql --user='abc_wpsitesdev' --password='(redacted)' -h localhost abc_wpsitesdev
ERROR 1045 (28000): Access denied for user 'abc_wpsites'@'localhost' (using password: YES)
abc.com [~]# mysql --user='abc_wpsitesfff' --password='(redacted)' -h localhost abc_wpsitesdev
ERROR 1045 (28000): Access denied for user 'abc_wpsites'@'localhost' (using password: YES)

Notice how each attempt at experimenting with the username still results in an attempt to access MySQL via the ‘abc_wpsites’ account. Any thoughts on what’s going on here?


Also, I should mention that I can connect via other methods with the appropriate credentials (e.g. via MySQL), so this seems to be some sort of problem with my understanding/the operation of MySQL’s CLI interface.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:18:25+00:00Added an answer on May 28, 2026 at 1:18 am

    I wouldn’t suggest passing your login information that way. This means your password is

    • Visible in the processlist (some distro’s will filter that but)
    • It’s either stored in a crontab or your bash .history file

    Instead create at script.cnf file that is NOT world readable.

    The contents will look like

    [client]
    user=abc_wspitesdev
    password=your_password
    

    Change your command line call to

    mysql –defaults-file=/path/to/script.cnf -h localhost abc_wpsitesdev
    mysql

    Edit

    Your other comment said you could connect as other users. If you have root access to this db run

    select user, host, passowrd from mysql.users;

    Compare the one that’s not working with others that are.

    The passwords that are stored will be hashes of the actual values. Are they all the same length? If one is significantly longer or shorter it could be the password was stored with an old password hashing method used in versions 4.x and earlier.

    What is the host for the account you are trying to connect through? Is it ‘localhost’ or an IP address? If it is your IP address this likely might be the problem. Since your command line call is connecting to localhost this will tell it to connect through a unix socket (/var/lib/mysql/mysql.sock perhaps). MySQL differentiates these connections from ones coming through the TCP stack.

    You could alternatively specify your full (non 127.0.0.1) IP address on the commandline if this is the case like

    mysql -u blah -pblah -h 1.2.3.4

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a reasonable size flat file database of text documents mostly saved in
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.