<Mac M1> Mysql ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES) - apple-m1

I've tried everything I've even uninstalled and installed versions MySQL 8.0.0 all the way up to 8.0.28.
I'm on a Mac M1
Here's what I've tried:
mysql -u root -p
Applied Password from the install*
This is what I got back:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
Stop Mysql Server
Quit Terminal
sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
Received:
2022-04-06T22:28:02.6NZ mysqld_safe Logging to '/usr/local/mysql/data/cyndrias-MBP.lan.err'.
2022-04-06T22:28:02.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2022-04-06T22:28:03.6NZ mysqld_safe mysqld from pid file /usr/local/mysql/data/cyndrias-MBP.lan.pid ended
Stop Mysql Server
Quit Terminal
Input:
sudo /usr/local/mysql/bin/mysql -u root
entered Password*
Received:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)

How are you launching mysql? I found that adding the --skip-grant-table flag allows me to connect without a password on the first entry. So for me, this looks like:
mysql.server start --skip-grant-table
Then to connect:
mysql -u root -p

Related

Why does mariabackup always give me access denied?

Context
Running MariaDb 10.6.7 on Windows 11. Trying to use mariabackup to do a partial backup of my database. Database, target backup folder and backup process all on the same PC.
Issue
In a batch file I have this:
cd C:\"Program Files\MariaDB 10.6\bin"
mariabackup --backup --target-dir='D:\OneDrive\Backups\MariaDb' --databases-exclude="*test" --user=root --password=myPasswordWithNoQuotes
Which keeps giving me the response:
Failed to connect to MariaDB server: Access denied for user 'root'#'localhost' (using password: YES)
Things I've checked
Running the batch file as administrator
root has full priviliges
Password is correct - checked by logging into root with MySQL Workbench and MySQLClient and HeidiSQL.
Question
How do I set access rights so that the backup can proceed?
When I changed the root password to something simple everything worked. So it looks like the issue was a special character in the password (a % character perhaps) or the way that the password parameter was formed in the mariabackup command.

How can I fix this login error in MariaDB?

I recently install MariaDB and use DB
but it has error on login
I check my plugin
root localhost mysql_native_password
Enter password:
ERROR 1698 (28000): Access denied for user 'root'#'localhost'
How can I fix??
Recent versions of MariaDB will authenticate users via unix_socket plugin when connecting via unix_socket (localhost).
So if you need to connect as root, just do a
$ sudo mysql
and enter password afterwards.

Serial port permission denied for non-root user with dialout group privileges even after reboot Ubuntu 18.04

I write systemd services that launch with root privileges and de-privilege themselves to a system account (called mxdaemon). These services require access to the physical serial port (/dev/ttyS0) on the PC. Serial port ls -l:
Serial port: crw-rw---- 1 root dialout 4, 64 Jun 13 22:00 /dev/ttyS0
When run as root, the service has no problem communicating via the serial port.
When the service is configured to de-privilege to mxdaemon, I get a permission denied error when attempting to access /dev/ttyS0.
mxdaemon is a member of both the dialout & tty groups:
mxdaemon : mxdaemon dialout tty
Even after logging out and/or rebooting the PC, I still get permission denied for ANY user besides root.
Hours of scouring the Internet suggest that everything is configured correctly.
Any help would be appreciated!
-Rob
#sawdust: Thanks for the reply! Here's the info...
/etc/group : dialout:x:20:mxdaemon,mxadmin
/etc/gshadow : dialout:*::mxdaemon,mxadmin
Thanks for the pointer #sawdust - here's what the command yielded...
ps -o user= -o group= -p 15150
mxdaemon root
So, the user is mxdaemon but it shows being part of the root group?

Debian Stretch MariaDB cannot authenticate from PHP application

I'm using a fresh installation of Debian Stretch, and installed PHP7 and MariaDB as recommended:
sudo apt-get install nginx mariadb-server mariadb-client php-mysqli php7.0-fpm php7.0-curl
Then using sudo mysql_secure_installation I followed the prompts to remove test users etc.
MariaDB seems to use unix_socket authentication (which is a new concept to me). I like how it restricts root access to sudoers and allows me to grant DB permissions to specific OS users.
However I'd prefer to assign individual user/passwords for each web application running on the server. They all run as www-data user on the system and I see no reason to let them share databases.
So I created a user for my first PHP script and granted access to a new database:
CREATE USER 'telemetry'#'localhost' IDENTIFIED BY 'yeah_toast';
UPDATE mysql.user SET plugin='mysql_native_password' WHERE user='telemetry';
GRANT ALL PRIVILEGES ON telemetry TO 'telemetry'#'localhost';
FLUSH PRIVILEGES;
But it refuses to let me connect from the application:
[error] 19336#19336: *20 FastCGI sent in stderr: "PHP message: PHP Warning: mysqli::real_connect(): (HY000/1045): Access denied for user 'telemetry'#'localhost' (using password: YES) in /path/to/database.inc.php on line 30
The credentials I'm using from the application are as follows:
Host: localhost (also tried 127.0.0.1)
Username: telemetry
Password: yeah_toast
Database: telemetry
I tried deleting and re-creating the username in case it was a password problem, and creating a user #'localhost' and #'%' but none seem to work. In fact when I log in using the same credentials from the command line without sudo it works great (mysql -utelemetry -p).
Am I missing a MariaDB configuration step here?

salt-ssh permission denied when attempting to log into remote system

I am new to salt-ssh and I have gotten it to work successfully for setting up a remote system. However, I have a login issue that I don't know how to address. What is happening is that when I try to run the salt-ssh commands I have to fight with then initial login process before eventually it just works. I am looking to see if I can narrow down what is causing me to have to fight with login process.
I am using OS X to run my salt-ssh commands against an ubuntu vagrant vm.
I have added my root user's ssh key to the root user authorized_keys on the vagrant vm. I have verified that I can log into the system using ssh without any issues
sudo ssh root#192.168.33.10
Here are what my config files look like:
roster
managed:
host: 192.168.33.10
user: root
sudo: true
Saltfile
salt-ssh:
config_dir: /users/vmcilwain/projects/salt-ssh-rails
roster_file: /users/vmcilwain/projects/salt-ssh-rails/roster
log_file: /users/vmcilwain/projects/salt-ssh-rails/saltlog.txt
master
file_roots:
base:
- /users/vmcilwain/projects/salt-ssh-rails/states
pillar_roots:
base:
- /users/vmcilwain/projects/salt-ssh-rails/pillars
I run this command:
sudo salt-ssh -i '*' test.ping
I enter my local user's password and I get this output
Permission denied for host 192.168.33.10, do you want to deploy the salt-ssh key? (password required):
[Y/n]
This is where my fight is. If the vagrant vm has the ssh key for the user I am executing salt-ssh as, why am I being told that permission is denied? Especially when I verified I could ssh into the system without using salt-ssh.
Clicking yes prompts me for the remote root user's password, which I didn't set and don't necessarily want to since an ssh key should have worked.
I'm hoping someone can tell me the best way to setup connections between both systems so that I don't have to have this fight every time.
I needed to set the priv in my roster to the rsa key that I am using to connect to the remote host:
priv: /Users/vmcilwain/.ssh/id_rsa

Resources