Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share. I'm trying to reinstall mysql on my MAC OS X Yosemite. For this I followed the instruction as mentioned below I also tried after this I installed mysql using homebrew using command brew install mysql.
I've looked at a number of similar questions and so I'm demonstrating that I've checked the basics. Though of course, that doesn't mean I haven't missed something totally obvious.:-) My question is: why am I denied access on a user with the privileges to do what I'm trying to do and where I have already typed the password and been granted access? (For the sake of completeness, I tried typing the wrong password just to make sure that MySQL client would deny me access at program start.) Background: Logged in to the shell of the machine running the MySQL server via ssh, I log in as root: myname@host $ mysql -u root -p -hlocalhost Enter password: Welcome to the MySQL monitor. Commands end with; or g. Your MySQL connection id is 62396 Server version: 5.5.18-log MySQL Community Server (GPL) Type 'help;' or ' h' for help. Type ' c' to clear the current input statement. Mysql Awesome.
My reading of the answers to similar questions suggests that I should make sure the the privileges are current with what is in the grant tables mysql FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql Next make sure I am who I think I am: mysql SELECT user; +-+ user +-+ root@localhost +-+ 1 row in set (0.00 sec).and really really make sure: mysql SELECT currentuser; +-+ currentuser +-+ root@localhost +-+ 1 row in set (0.00 sec) mysql So far so good. Now what privileges do I have?
Notice how the output of SHOW GRANTS FOR 'root'@'localhost'; did not say 'ALL PRIVILEGES' but had to spell out what root@localhost has. GRANT ALL PRIVILEGES will fail, because a user can not grant what he/she does not have, and the server seem to think something is not here. Now, what's missing then? I also had the same problem with this but on Windows after upgrading to MySQL 5.5 from MySQL 5.1. I already tried changing, creating, and resetting password mentioned in, and, no clue. I still get the same error: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) I'm able to connect normally, show all databases, do selects and inserts, create and add users, and but when it comes to GRANT, I'm screwed up. Those access denied error shows up again.
I managed to solve this problem by fixing the privileges by the following command on the MySQL server bin/ directory as mentioned in: C: MySQL Server 5.5 bin mysqlupgrade Then, the problem gone away. I hope this solution works on Linux too since usually MySQL provide the same command both on Linux and Windows. This happened to me when I tried to install a higher MySQL version than the one coming with the distribution.
I erased the old version then installed the new one (rpm -e. Then rpm -i MySQL-server. ) But did not realize that the files in /var/lib/mysql were still from the older version (with differences as explained by Marc Alff - thanks!) I could have done an mysqlupgrade, but as I wanted to start from scratch I did: # su - mysql $ rm -rf /var/lib/mysql/. $ mysqlinstalldb # /etc/init.d/mysql start Then set root password (/usr/bin/mysqladmin -u root password), and all worked as expected with the GRANT commands. I had the same problem, i.e. All privileges granted for root: SHOW GRANTS FOR 'root'@'localhost' G.
![1045 1045](/uploads/1/2/5/4/125450361/143525220.png)
1. Row.
Grants for root@localhost: GRANT ALL PRIVILEGES ON. TO 'root'@'localhost' IDENTIFIED BY PASSWORD '.blabla' WITH GRANT OPTION.but still not allowed to create a table: create table t3(id int, txt varchar(50), primary key(id)); ERROR 1142 (42000): CREATE command denied to user 'root'@'localhost' for table 't3' Well, it was cause by an annoying user error, i.e. I didn't select a database. After issuing USE dbname it worked fine.
On Debian (, 7.8) with MySQL 5.5.40, I found SELECT. FROM mysql.user WHERE User='root' G showed the Eventpriv and 'Triggerpriv` fields were present but not set to Y.
Running mysqlupgrade (with or without -force) made no difference; I needed to do a manual: update user set Eventpriv = 'Y',Triggerpriv = 'Y' where user = 'root' Then finally I could use: GRANT ALL PRIVILEGES ON. TO 'root'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION and then use it more precisely on an individual database/user account. You may have come to this question with MySQL version 8 installed (like me) and not found a satisfactory answer.
I get a SQLSTATE28000 1045 Access Denied error every time I try to connect my ownCloud instance to my MySQL database as @localhost. This is on a clean, newly installed copy of Ubuntu server with a LAMP stack. After going round the following steps I've tried already to debug this problem I have tried a clean install from scratch and still get no luck (also trying all the below steps).
Things I've tried:. Initially using a newly created user owncloud with a random character password and using that (user had been granted access to the database and privileges had been flushed).
Logging on in a terminal using mysql -u owncloud -p, works perfectly fine. Logging on like the above but with -h localhost, also works fine. Trying for testing's sake to setup owncloud with my root MySQL user.
Logging on in a terminal using mysql -u root -p -h localhost, plus of course without the -h localhost too. Using 127.0.0.1 instead of localhost for root and owncloud users. Using a previous version of ownCloud (8.2.2 and 8.2.3 instead of 9.0.0). Reusing a previous config file from another ownCloud instance (which I'm trying to replicate on this new server to take the old one's place) but that causes an internal server error - most likely due to not being able to access the database. Replacing all files in the /var/www/owncloud directory with Drupal 8 - creating a test site in Drupal using the same MySQL user and table ( owncloud for both) and this bizarrely works. Taking an SQL dump and a copy of the files in /var/www/owncloud from the old server, putting them on the new server and it connects to the database fine (majorly flawed though because I have a large data directory so I didn't copy that over, I could try that though if I have to but that wasn't the point of this test).
I've run entirely out of ideas, tried lots of Googling about specifically this error on ownCloud and this error generally but they all seem to be people not setting passwords correctly or forgetting passwords. I know my passwords are indeed correct because they work in a terminal (and I've used exact copy & paste). For those interested, I'm using: Ubuntu 14.04.3 LTS 64-bit, PHP5, MySQL V14.14 D5.5.47 and ownCloud 9.0.0. Any new ideas of things to try are very welcome!