I went through all similar or identical questions (this and this, for ex.) but still can't solve the problem.
I am on Xenial and have MySQL 5.7.12. I do not remember setting any password during installation (if it asked, I provided empty one).
I tried to go through password reset using --skip-grant-tables, as described here, it updated the database row, but I still cannot login.
Reconfiguring with sudo dpkg-reconfigure mysql-server-5.7 doesn't do anything, I get this:
Checking if update is needed.
This installation of MySQL is already upgraded to 5.7.12, use --force if you still need to run mysql_upgrade
$ sudo dpkg-reconfigure --force mysql-server-5.7
Checking if update is needed.
This installation of MySQL is already upgraded to 5.7.12, use --force if you still need to run mysql_upgrade
Any ideas?
MySQL 5.7 generates a random root password by itself on installation.
This was a new change in MySQL 5.7.4, and described in the release notes: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-4.html
The installation process creates only a single root account,
'root'#'localhost', automatically generates a random password for this
account, and marks the password expired. The MySQL administrator must
connect as root using the random password and use SET PASSWORD to
select a new password. (The random password is found in the
.mysql_secret file in the home directory of the effective user running
the script.)
I never find the .mysql_secret file, but the random password is also output in the MySQL error log (e.g. /var/log/mysqld.log on Linux). The notice looks like this:
2016-07-11T15:59:54.922316Z 1 [Note] A temporary password is generated for root#localhost: f14_W1lN7FfP
You could either reinstall everything, which i did. I had initially installed using macos package installer. That didn't get me anywhere.
So uninstalled everything, then upgraded brew, and installed via brew. Running the mysql shell proved a messy affair. Ultimately what worked was mysql -u root -p.
I was running it on localhost, so turns out root password wasn't required. Weirdly, mysql -u root -p <password> threw the "access denied" message.
Proper re-installing helped. Removed everything associated (this instruction, but it is important to specify the version of mysql, e.g. apt-get --yes purge mysql-server-5.7 mysql-client-5.7, and I also deleted mysql-common and all dependencies to be sure).
Then installed again (apt-get install mysql-server mysql-client) and when it asked for a password, this time, I gave it one. It works now.
Related
I have MySQL stable 8.0.19 (bottled) installed via mac HomeBrew:
brew install mysql
and it asks me to follow these instructions in the Caveat section:
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -uroot
To have launchd start mysql now and restart at login:
brew services start mysql
Or, if you don't want/need a background service you can just run:
mysql.server start
and when I run the mysql_secure_installation command with or without sudo I get:
Securing the MySQL server deployment.
Enter password for user root:
Now I tried looking for the default password. The MySQL installation process for macOS here shows that on the last step a temporary password is provided for the user:
[][5]
(source: [mysql.com](https://dev.mysql.com/doc/mysql-osx-excerpt/5.7/en/images/mac-installer-root-password.png))
However, I do not see any information about a temporary password within the HomeBrew terminal outputs. From here I tried:
sudo grep 'temporary password' /var/log/mysqld.log
but I get:
grep: /var/log/mysqld.log: No such file or directory
then I tried looking for that log file:
sudo find / -name mysqld.log
but I get lots of find: ... Operation not permitted instead of any meaningfull results.
I would appreciate if you could help me know
if I have done everything correctly so far,
if not what mistakes I have made and how to fix them
if yes how I can acquire the temporary password
what are the next steps
Ideally, I should be able to follow the rest of this tutorial within the GUI.
Ok, I think I had some progress. I ran
brew services list
and it showed that mysql stopped, now I ran:
brew services start mysql
now the mysql_secure_installation script ran smoothly with
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
helping me set up a password and other settings. Now you may install the MySQL Workbench (the GUI seen in the tutorial) by:
brew cask install mysqlworkbench
and you should be able to find and run MYSQLWorkbench from your /Applications/ folder!
P.S. Wrote simple instructions here.
For macOS users, there is DBngin (https://dbngin.com) that gives
you push-button start/stop for MySql, PostgreSQL (and redis) .. different
versions with non-overlapping config/data directories.
Really saves me - and my students! - in my DB course.
I seem to be unable to set a valid MySQL root password that Phabricator can use during the installation.
Every time I try to restart the phd daemons (as per these instructions: https://gist.github.com/sparrc/b4eff48a3e7af8411fc1) I get the following exception:
[2018-09-20 08:38:09] EXCEPTION: (PhabricatorClusterStrandedException) Unable to establish a connection to any database host (while trying "phabricator_config"). All masters and replicas are completely unreachable.
AphrontConnectionQueryException: Attempt to connect to root#127.0.0.1 failed with error #1698: Access denied for user 'root'#'localhost'. at [<phabricator>/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php:158]
I was, however, able to successfully complete the ./bin/storage upgrade Phabricator command after reinstalling MySQL.
I have tried:
sudo dpkg-reconfigure mysql-server-5.7 - Didn't prompt for a new password
Logging in with mysqld_safe --skip-grant-tables & and running update commands on the root password. All seems to be successful, but as soon as I try Phabricator again, I get the exception.
Looking for temporary passwords:
sudo grep "temporary password" /var/log/mysqld.log
grep: /var/log/mysqld.log: No such file or directory
Note that I am using ./bin/config set mysql.pass 'mypassword' after changing it using any of the methods above. I've tried no password as well, which doesn't work. Once I have run the Phabricator storage upgrade command, I can no longer access mySQL at all and any steps to reset passwords seem to take no effect.
I'm running MySQL 5.7 and PHP 5.6 on Ubuntu 18.04
I've done a search on this, and though there are many results, all of the proposed solutions seem to fail for one reason or another.
One thing to note is that many of the solutions require entering mysql and then making some configuration changes to alter the user account. For the record, even so much as entering 'mysql' or 'mysql -u root' (and so on) at the command prompt will bring up the error.
I'm just using mysql for some big data classes, so I don't need a server and I don't need to connect any apps or anything like that (although I will be running HBase).
When I did the initial install:
sudo apt-get install mysql-server
I was never prompted for a password at any point. Likewise, if I run:
sudo dpkg-reconfigure mysql-server-5.7
I get the message:
Checking if update is needed.
This installation of MySQL is already upgraded to 5.7.19, use --force if you still need to run mysql_upgrade
Running it with '--force' just brings about the same error.
I've tried running:
sudo mysqld_safe --skip-grant-tables &
But I only get returned to the command prompt with "[1] 16654"
Just in case, I set chmod 777 on '/var/lib/mysql*' as well as '/var/run/mysqld'
I have also tried the unix instructions posted below, to no avail:
https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
The error log from /var/log/mysql was a bit unwieldy, so I have uploaded it here:
https://pastebin.com/exDeKHeA
Thanks in advance for any responses. If any other files or info is needed, please let me know.
I installedd LLMP on default, fresh Linux Mint 18 Mate install. Everything is updated and pretty fresh. Then the strange problem occured with logging into the database.
My exact steps:
1. Installed lighttpd. It crashed until I installed also gamin package, then it works.
Installed php7 with php-mysql
Installed mariadb-server
Run mysql_secure_install, defined new root password, answered all Y for deleting test db, disabling anonymous accounts and disallowing root login from tcp, etc. Everything was suggested as a valid, default answer.
Installed phpmyadmin, this fails on post-install, but running apt-get install -f repaired it and finished install correctly.
WTF1: Now, as root user I can login without password to mysql in the console.
WTF2: I can't login to mysql as a regular user, even when I give good password. It says "ERROR 1698 (28000): Access denied for user 'root'#'localhost'"
WTF3: I can't also login to database using phpmyadmin, using root account and proper password, when run on my localhost workstation via lighttpd.
What the heck is going on? My expectation was it should work out of the box, allowing me to login ONLY with root password either on CLI or via phpmyadmin. What is wrong?
I solved this and the answer is in the comment to the question.
I am installing MySQL on Windows with the following command line:
MySQLInstallerConsole community install -silent server;5.7.12;x64:*:type=config;servertype=Server;openfirewall=true;generallog=true;serverid=3306;enable_tcpip=true;port=3306;rootpasswd=%1;installdir="C:\MySQL\MySQLServer-5.7":type=user;username=foo;password=bar;role=DBManager
This line is contained in a script, and I pass in the root password from a random generated string. However, I am getting an access denied for 'root'#'localhost' when trying to access the server via
mysql -u root -p
(and providing the password)
I can not find any issues with the parameters for MySQLInstallerConsole. Connecting as user foo even works, but I really need the root password to work.
Any ideas?
I finally figured out what the issue was: the system had a MySQL server installed before. The service and binaries had all been removed, but there still was a MySQL data directory in the default location (somewhere in %ProgramData%"). This seems to cause to make the installer console fail to finish the new installation WITH a different root password.
Removing the old data directory and re-running the installer command line as stated in the original question (without any changes) resulted in successful installation.