'mysql_upgrade' Access denied for user 'root'#'localhost' on M1 Mac - installation

I followed the macos installation of MariDB on their website and I always get this error when I try to run mysql_upgrade
I also can't secure the installation due to the same error
Reading datadir from the MariaDB server failed. Got the following error when executing the 'mysql' command line client
ERROR 1698 (28000): Access denied for user 'root'#'localhost'
FATAL ERROR: Upgrade failed
I tried following tutorials but they don't work.
What should I do?
EDIT
Sorry, I forgot I posted a question here.
It's all good now! I was able to make it work. All I did was use mariadb -u root -p instead, and the password was root.
The tutorial I used was the one from Mariadb's official website.
As for this solution, I forgot where I got it from but, kudos to you who helped me!

You haven't posted which tutorials you have followed.
Have you tried
mysql_upgrade -p
it will prompt for root password. You can even run it with a different user using the -u option.
Hope this helps.
FYI: https://mariadb.com/kb/en/mysql_upgrade/

Related

Fixing Broken Kerberos on macOS

I've got a macOS 10.13 server running, on which I have recently had to change the hostname (upstream IT requirements) - and I suspect this has broken Kerberos.
Changing the hostname appears to have been successful: I exported the Open Directory setup, modified it, and reimported it into the updated setup - user accounts exist, and manual authentication works as expected. changeip is happy:
mac-mini:~ server_admin$ sudo changeip -checkhostname
dirserv:success = "success"
However SSO from client machines does not appear to be successful.
Attempting to run kinit with a valid user account shows this:
mac-mini:~ server_admin$ kinit test#MAC-MINI.EXAMPLE.COM
test#MAC-MINI.EXAMPLE.COM's password:
kinit: krb5_get_init_creds: Server (krbtgt/MAC-MINI.EXAMPLE.COM#MAC-MINI.EXAMPLE.COM) unknown
Looking at /etc/krb5.conf, I only see this:
[libdefaults]
kdc_timeout=5
...which is the same as it was on my previously-working configuration.
And now I'm a bit stumped. All the documentation for destroying and rebuilding Kerberos setups seem to be out of date. Any ideas?!
Thanks.

Ping-Connection-Pool throws Access Denied to DB although user exist and credentials are OK

I'm trying to create a jdbc-connection-pool using payara on the console. Using ./asadmin on Payara_Server/bin/
It is Running on Linux and the credentials for the database are user=jc and password=hola123 (dummies), It is for sure this credentials work. I tried them on Mariadb.
I create a connection pool using ./asadmin on Payara, it looks like this:
./asadmin create-jdbc-connection-pool --datasourceclassname org.mariadb.jdbc.MariaDbDataSource
--restype javax.sql.DataSource --property user=jc:password=hola123:DatabaseName=​cinev2:ServerName=localhost:port=3306 cinePool
Now, when I try:
./asadmin ping-connection-pool
I get an error like this:
remote failure: Ping Connection Pool failed for cinePool.
Connection could not be allocated because:
Access denied for user 'jc'#'localhost' to database '​cinev2' Please check the server.log for more details.
Command ping-connection-pool failed.
What would be the causes of this Issue other than Credentials? I have checked if the credentials are right and they are, So I've no clue on the issue.
Since it works when locally connecting to the DB it probably really is an access issue.
Please check if you did all steps outlined here: Access denied for user 'root'#'localhost' (using password: YES) after new installation on Ubuntu

postgres throws the error psql: FATAL: role "username" does not exist

Please, I need help with my postgres server. I have problems starting the server. I was using the app here a few months ago and everything was fine. Today I spent hours trying to start it yet couldn't. I then realised I had another instance of PostgreSQL installed. I uninstalled version 9.6 blocking my app.
Now after trying again, the PostgreSQL app throws the error when I use psql:
FATAL: role "username" does not exist
I didn't set the role or user but it somehow took my username and is throwing does not exist. Please, how do I start my server. I have seen someone with a similar issue here but unlike in his case, I didn't even get to start the server. not to speak of deleting the database. Please, how do I address this? Any help would be appreciated.
I also noticed he was able to execute
which psql
which returned his supposed psql path. It does not return anything in my case. Not sure how the configuration works, this is my second time using this database and it failed right away.
Thank you for your time, as answered in one of the SO question here. Running
sudo -u postgres -i
did give me access to postgres, but if you are using the postgres app like myself here . Running psql commands would not work for you as postgres is not installed globally on your machine. But running
'/Applications/Postgres.app/Contents/Versions/9.5/bin'/psql -p5432
which is the exact command the postgres app execute when you attempt to start the service works great and start the service for me. You can then proceed and add the role and database your postgres app looks for by default. So in summary. Below is what worked for me.
$sudo -u postgres -i
$'/Applications/Postgres.app/Contents/Versions/9.*/bin'/psql -p5432
#CREATE USER postgres SUPERUSER;
#CREATE DATABASE postgres WITH OWNER postgres;

psql: could not connect to server

The error in its entirety reads:
psql: could not connect to server: No such file or directory. Is the
server running locally and accepting connections on Unix domain socket
"/tmp/.s.PGSQL.5432"?
This is my second time setting up Postgresql via Homebrew on my Mac, and I have no clue what is going on. Previously, it had been working. At some point, I must've entered a command that messed things up. I'm not sure. Now, whenever I enter a SQL command from the command line, I receive the above message. I've run a command to check whether the server is running, and it apparently is not. If I attempt to start the server using
$ postgres -D /usr/local/pgsql/data
I receive the following error:
postgres cannot access the server configuration file
"/usr/local/pgsql/data/postgresql.conf": No such file or directory
I've uninstalled and reinstalled Postgresql via Homebrew, but the problem persists. I'm completely at a loss as to how to get this working. Any help would be appreciated.
your data directory is most likely wrong.
issue a "sudo find / -name "postgresql.conf" " on your terminal to see where your postgres file resides. Then, do an ls in the data directory. Use that in the -D option when starting postgres.

Terminal mysql -v gives Access Denied Error 1045 (28000)

When I try to check the mysql version using terminal I get the following error.
KillBill:~ KillBill$ mysql -v
ERROR 1045 (28000): Access denied for user 'KillBill'#'localhost' (using password: NO)
but when I do the following and add the password it works and logs me into MYSQL prompt.
KillBill:~ KillBill$ mysql -u root -p
Why am I getting the following error on mysql -v prompt only. What do I do to fix it? Everything else is working fine, I can connect to mysql db in the apps I am developing no problem whatsoever.
Any help will be highly appreciated. Thank you!
If you start the mysql client without givinng the -u option, it assumes you want to login with the current username, in your case KillBill. If this user isn't a mysql user or is a mysql user, but has to specify a password to login, the user will be refused a connection.
Login as "root", create a mysql user names "KillBill" and assign a password. Have look here for the syntax of that. Then assign appropriate rights using the GRANT statement.

Resources