What is the relationship between local machine hostnames and MySQL hostnames? - mysql

I have Fedora 19 on my local machine and changed the default hostname to 'my.greathostname'.
So that means when I am using the terminal my prompt is:
[me#my ~]
I installed MariaDB.
I created a new user in MariaDB eg 'newuser#my.greathostname'.
When I try and login to MariaDB with 'mysql -u newuser -p' and enter password I get:
ERROR 1045 (28000): Access denied for user 'newuser'#'localhost' (using password: YES)
So, by default, it is trying to login to 'localhost' and not 'my.greathostname'.
Why is it trying to login to 'localhost' when the hostname of my local machine is 'my.greathostname'.
The reason I want to change the hostname in MariaDB is just to have a more 'custom' experience.

Related

Have phpmyadmin and apache, but need to log in to database (Linux Mint)

I am new to linux but learning it pretty well. I have apache working on localhost, I installed mysql through this package: mysql-server 8.0.19-obuntu5
But I need to create a user that works with phpmymadmin and mysql and has access to all the databases. I'm getting these error with root (would post photo but the photos are causing post problems):
Cannot log into mysql server then
mysqli_real_connect(): (HY000/1698): Access denied for user 'root'#'localhost'
Connection for controluser as defined in your configuration failed.
mysqli_real_connect(): (HY000/1698): Access denied for user 'root'#'localhost'
See my config here, without the dollar sign char for vars and colins:
dbuser 'root'
dbpass 'Edited Out For This Post'
basepath ''
dbname 'phpmyadmin'
dbserver 'localhost'
dbport '3306'
dbtype 'mysql'
What should I do to get me logged into all my dbs. Willing to make new user.
Many versions of phpmyadmin disallows root login. Hence, run the following to login as root (in console)
sudo mysql -p -u root
then create a new user (say pmauser) with
CREATE USER 'pmauser'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password_here';
then grant this user the permission
GRANT ALL PRIVILEGES ON *.* TO 'pmauser'#'localhost';
Now try login phpmyadmin by pmauser

I can't connect to MySQL server in any way (on Windows)

My problem is below:
C:\Users\ordek> mysql
ERROR 1045 (28000): Access denied for user 'ODBC'#'localhost' (using
password: NO)
C:\Users\ordek>mysql -u root
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using
password: NO)
C:\Users\ordek>mysql -u root -p
Enter password: ****
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using
password: YES)
I tried lots of solutions before asking here. I've even tried reinstalling MySQL but surprisingly this problem still exists. In Workbench I can't connect to any connection. I always login to the MySQL server as superuser and subsequent attempts to change privileges didn't work because I can't log into MySQL in the usual ways.
In Workbench it doesn't matter which user: root or not, you'll get this message.
[Window Title]
MySQL Workbench
[Main Instruction]
Cannot Connect to Database Server
[Content]
Your connection attempt failed for user 'user1' to the MySQL server at
127.0.0.1:3306:
Access denied for user 'user1'#'localhost' (using password: YES)
Please:
1 Check that MySQL is running on address 127.0.0.1
2 Check that MySQL is reachable on port 3306 (note: 3306 is the default,
but this can be changed)
3 Check the user user1 has rights to connect to 127.0.0.1 from your
address (MySQL rights define what clients can connect to the server and
from which machines)
4 Make sure you are both providing a password if needed and using the
correct password for 127.0.0.1 connecting from the host address you're
connecting from
In "test connection"(WORKBENCH) I always get this message:
[Window Title]
MySQL Workbench
[Main Instruction]
Failed to Connect to MySQL at 127.0.0.1:3306 with user user1
[Content]
Access denied for user 'user1'#'localhost' (using password: YES)
In my mind this is a problem with privileges, but I don't know what to do because I'm a beginner at MySQL. If you know how to overcome this problem, please let me know.
I believe you installed MySQL (windows) using .msi package. As it .msi allows you to do the installation step by step and you can set "root" password.
If you have root password, make sure MySQL services are started.
Control panel > services > Mysql
The user ordek seems unknown to mysql . Switch to root user and it will work .
If this is not possible , or the root password is unknown , re-install mysql , make a note of the root password for future use , create the ordek user and assign it the access rights it needs .

Mysql client doesn't connect to external server

I'm trying to connect to external mysql server through linux command line.
Whe I try for example:
mysql -h 102.235.10.77 -u root -p password
it gives the next error:
ERROR 1045 (28000): Access denied for user 'root'#'190.201.179.249' (using password: NO)
Where 190.201.179.249 How you can see isn't the external server IP if not my local IP.
I already check out external connections at MySQL Server and 3306 port too, it Seems it's a local problem as if I can't connect to another IP than localhost.
regards.

Unable to set password for mysql

i am installing mysql in my fedora 17 machine and i am getting the following error while trying to set my username and password.
mysqladmin -u root password xyz
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'#'localhost'
I am getting this error while setting up the username and password the first time itself.
Please help.

MYSQL can't start service on Windows 7

EDIT: This happened most of the times, due to power failure.
Two things which worked for me.
1. Knowing how to change root password in MySQL, and taking backup of databases.
2. Install MYSQL as service.
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install
I had done clean installation of MYSQL 5.6 few days ago.
On first day everythng was fine. I could access city and world tables.
On next day I started getting below errors. Some were I read to run mysqld at admin level.
And it solved problem, but I couldn't access city and world table anymore.
On third day. I am getting only this errors.
Note: MYSQL service running previously fine, when firewall, antivirus (avast) and apache was running.
When run on admin mode :
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysql -u root -p localhost
Enter password: ***********
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysql -u root -p localhost
Enter password: *
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysql -u root -p localhost
Enter password:
ERROR 1049 (42000): Unknown database 'localhost'
When run on user mode (who is admin also) :
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysql -u root -p localhost
Enter password: ***********
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysql -u root -p localhost
Enter password: *
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysql -u root -p localhost
Enter password:
ERROR 1049 (42000): Unknown database 'localhost'
Not able to start MYSQL Service from Control Panel\All Control Panel Items\Administrative Tools\Service
Error Message ; WIndows could not start the MYSQL56 service on Local Computer
Error 1067 THe process terminated unexpectedly
Regards : Msinfo
You need to use "-h" before "localhost" if you want to specify a host, otherwise just remove "localhost" and it should work fine, considering a running server on your system.
Also, MySQL server is "mysqld.exe" not "mysql.exe". mysqld (d stands for daemon) is the server which should run in background and does the actual stuff like creating tables,DBs etc. But mysql.exe just connects to the server and helps you to execute SQL queries. mysql.exe is just an interface to connect to server. If you want to know why your server (windows service in your case) is not starting, you should see the XXX.log in your MySQL server installation folder under Program Files.
try by creating the database in MySql by the respective name "localhost"
eg: create database localhost;
by doing this you can clear the below error
ERROR 1049 (42000): Unknown database 'localhost'
hope i am correct
Thanks,
Daya