MYSQL can't start service on Windows 7 - mysql

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

Related

Installing SQL problem - "Your connection attempt failed for user 'root' to the MYSQL server at localhost:-3306

I cannot log in through the terminal either:
When I type in terminal: mysql -u root -p -h localhost -p 3306
I see the following message:
"Enter password:
ERROR 1698 (28000): Access denied for user 'root'#'localhost'"
I have tried many solutions proposed throughout the internet, with no avail. I believe, possibly, these are the problems:
I did not create a user with CREATE USER - I merely installed mysql, opened port 3306 through firewall,configured its installation security and created a password.
Maybe my router has my port blocked. I do not know how to check this, but it is very unlikely.

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 access denied for user ERROR 1045

I'm trying to user mysql on my machine, but I can't access the program.
I added configuration using mysql_config_editor as such:
mysql_config_editor set --login-path=client --user=root -p --host=localhost
and when i do a print i get:
[client]
user = root
password = *****
host = localhost
But when I try to connect to mysql, I get the following error
#mysql -u root -p
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using passowd: YES)
And when I try to connect like this, i get:
#mysql -u root -p -h127.0.0.1
ERROR 1130 (HY000): Host 'localhost' is not allowed to this MYSQL server
Every other answer I found was to do a SQL command. But i can't get inside the shell to do it.
Thanks
Have you already tried using the --skip-grant-tables option? If you have, and it doesn't allow you to access the mysql shell, go into your mysql installation folder and open my.ini file (my.cnf for most Linux distros). Inside it you'll find a mysqld tag, add skip-grant-tables underneath it and restart your mysql server. You'll be able to access your shell and therefrom edit the rights/privileges.

MySQL - Can't Log In - Access Denied - Brand New Installation (OpenWRT)

I installed MySql on OpenWRT successfully without any errors - see below but I am having issues logging in - it's telling me access denied. But according to everything I found on the Internet, the default user name is root and there is no password so I must be a special case.
Please take a look below:
root#OpenWrt:~# mysql_install_db
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h OpenWrt password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/scripts/mysqlbug script!
root#OpenWrt:~#
I then start the server:
root#OpenWrt:~# /usr/bin/mysqld &
root#OpenWrt:~# 160104 10:48:04 [Note] Event Scheduler: Loaded 0 events
160104 10:48:04 [Note] /usr/bin/mysqld: ready for connections.
Version: '5.1.73' socket: '/var/run/mysqld.sock' port: 5158 Source distribution
Then I try to log on:
root#OpenWrt:~# mysql
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
root#OpenWrt:~#
I then tried:
root#OpenWrt:~# mysqladmin -u root -p root
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'#'localhost' (using password: YES)'
root#OpenWrt:~#
In the above, for password I entered: "root" when it asked me for it.
I also tried leaving it blank but no luck. I also tried ('new-password').
I have spent hours searching this site and other sites but none of the suggestions I've tried work. Also, in my case, mysqld_safe does not appear to be installed (and I don't believe it's available for OpenWRT).
Point of references: http://forums.mysql.com/read.php?34,140320,140324, http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html, How to find out the MySQL root password, 'Access denied for user 'root'#'localhost' (using password: NO)' and many other of which I lost track -- too many and none of them work.
Update
Please take a look below:
root#OpenWrt:~# /usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'#'localhost' (using password: NO)'
root#OpenWrt:~# /usr/bin/mysqladmin -u root password 'root'
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'#'localhost' (using password: NO)'
root#OpenWrt:~# /usr/bin/mysqladmin -u root password 'admin'
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'#'localhost' (using password: NO)'
root#OpenWrt:~# mysqladmin reload
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'#'localhost' (using password: NO)'
root#OpenWrt:~# /usr/bin/mysqladmin -u root password
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'#'localhost' (using password: NO)'
Have you tried following the instructions it gives you after install? specifically:
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
It could be the case that there is no root user created or some such.
Also perhaps force a reload of the database, especially once you add a user to force it to reload the user table:
mysqladmin reload
HTH
As mysql log file is suggesting, try below comamnd-
/usr/bin/mysqladmin -u root password 'your_root_password';
Even you can try without password as per below and set root password from mysql prompt-
mysql -uroot
I fixed it! I found what the problem was!
MySql looks for the user name in its tables and if it keeps telling me "access denied" it means the "root" user most likely doesn't exist (since it is a brand new installation). So I removed the entire installation and deleted "everything" MySql associated.
I ran the install script with the --help option and check this out!
--user=user_name The login username to use for running mysqld. Files
and directories created by mysqld will be owned by this
user. You must be root to use this option. By default
mysqld runs using your current login name and files and
directories that it creates will be owned by you.
Then, I ran the script again but I passed the --user=root parameter:
mysql_install_db --user=root
root#OpenWrt:~# mysql_install_db --user=root
Voila! :)
root#OpenWrt:~# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Having said this, now I am thinking, I could have probably searched the databases with a notepad or some sort of database editor since they are in ASCII format and see if I can find an entry for user root but the files are gone now. Either way, this is the solution!

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

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.