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.
Related
I want to install phpmyadmin on Ubuntu 20.04. I take the password 2 times (first I tryed root password but after I tryed leave the field empty or use other password). Any time I error like screen of my error. I found this tutorial.
Author of this article wrote:
From the prompt, run the following command to disable the Validate
Password component. Note that this won’t actually uninstall it, but
just stop the component from being loaded on your MySQL server:
But this component is disable and yet I still have this error. How can I solve my problem
The error message you posted is different from the Validate Password one in the tutorial. I suggest re-enabling the option that you disabled.
Your error is showing that you (or someone) has changed the password of the MySQL user that Ubuntu (and Debian) uses for administrative purposes (debian-sys-maint). Details of that user are documented in README.Debian and the password is stored on disk in /etc/mysql/debian.cnf.
To resolve this, you can simply set the password to a known value and edit the configuration file to tell your system the new password.
Presumably, you're using MySQL 8.0.20, in which case you would connect through the command line client (mysql -u root -p) and run a command like this: ALTER USER 'debian-sys-maint'#'localhost' IDENTIFIED BY 'aReallyComplexPassword';.
On the chance that you're using MariaDB, the command is SET PASSWORD FOR 'root'#'localhost' = PASSWORD('aReallyComplexPassword');.
You won't need the password again after you put it in /etc/mysql/debian.cnf). Note that you'll need to edit the debian.cnf file as root or sudo.
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 had mysql already installed in my system and I uninstalled it because it was not running successfully.
Now when I installed a new version of mysql, the server starts and stops successfully. But it still accepts the password of my old mysql.
If I try to change the password, which I need to because it says my old password has expired when I try to connect it to workbench, it gives me the following error:
File './mysql/user.MYD' not found (Errcode: 2 - No such file or directory)
I also tried running this command:
mysql -uroot -p
It accepts my old password and then if I further run any other command, example
mysql> USE mysql;
It asks me to reset the password and when I do it again gives me the above error
If you've trashed your MySQL system tables you'll need to recreate them with the mysql_install_db command-line tool or something equivalent. This is done while the server process is stopped and should initialize everything correctly.
I have recently installed MySQL 5.7.16 on an iMac running El Capitan. I had a few minor hiccups initially because I forgot the root password but that has now been reset and I can now log into MySQL as root user using:
$ mysql -u root -p
However, when I try to connect to MySQL server as root using SequelPro, I get the message:
Unable to connect via the socket, or the request timed out.
Double-check that the socket path is correct and that you have the necessary privileges, and that the server is running.
MySQL said: Your password has expired. To log in you must change it using a client that supports expired passwords.
When I look in /tmp folder, I was expecting to find mysql.sock but, instead, there is a file called mysql.sock.lock. Could this be causing the problem? I can't find where that .lock file has come from and I'm not sure what to do about it. Any help would be appreciated.
I'm not entirely sure what happened to cause the root password to expire but something had thrown a spanner in the works. Anyway, the solution for me was to log into MySQL from the Terminal using:
$ mysql -u root -p
...and then alter the root user's password using:
> ALTER USER 'root'#'localhost' IDENTIFIED BY 'NewPass';
That seemed to do the trick. I was then able to log in to MySQL using Sequel Pro with no problems.
Instead of using a socket connection, you could try connecting via Sequel Pro's standard connection using 127.0.0.1 as the host.
Thus spake the 5.7 docs:
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 assign a new password. (The server writes the random password to the error log.)
So, connect from terminal and change the root password.
Either your first password may not have been saved OR it just truly never persisted.
For me it was the sudo /usr/local/bin/mysql_secure_installation that may not have ever persisted the password correctly. Since your first password never changed, there is no password or ,like your error said, "expired" to nothing.
Run or rerun the code above, don't type anything for the password field and follow the steps, from the preloaded setup program.
I have an XAMPP MySQL installation and want to recover the root password. I am aware that questions have asked this already, however they are Linux methods of doing it (I'm on Windows) and I can't seem to figure out what exactly the Linux commands translate to in XAMPP - I tried looking for a place to configure the arguments to not use network etc but couldn't.
Any help would be appreciated
Recovering the exact current password is apparently not possible. This solution is for resetting a lost password on a Windows machine.
I have tested this code for 5.7[.22] (while upgrading to 8.0). Please verify your installed version and paths accordingly. (x86 machines will have slightly modified values)
-
Stop MySQL server from the services, if it is running.
Create a file mysql-init.txt in D:\ drive and put the following line in it:
ALTER USER 'root'#'localhost' IDENTIFIED BY 'NewRootPassWillComeHere';
Open command prompt and execute the following commands:
C:\> cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"
C:\> mysqld --defaults-file="C:\\ProgramData\\MySQL\\MySQL Server 5.7\\my.ini" --init-file=D:\\mysql-init.txt --console
The option --console will give the output in the command prompt.
Password has been reset successfully and the file mysql-init.txt can be deleted.
-
Source and other scenarios: How to Reset the Root Password