I try to use Laragon but when i try to create a new Laravel project, Laragon try to create the DB without using a password.
I have this error :
Access denied for user 'root'#'localhost' (using password: NO)
How to define the password to Laragon ?
Ty for your time.
In Laragon's Menu > MySQL, you can:
- Change your root password.
- Reset your root password.
Just go to my.ini and in the first line configure your password.
Just log in to the database and run this command
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('newpassword');
FLUSH PRIVILEGES;
Like so:
Click on the Database button in the Dashboard.
Open the default connection (no password). This will open HeidiSQL.
In the Query tab enter the command above and execute it.
Reconnect.
I already had mySQL all setup on my PC
I went to MySQL -> my.ini this opened the my.ini file in a editor
I then entered mySQL password which I have already had. Saved the file and Laragon used this password successfully
i had the same problem , and none of the above suggestion would work
the only thing i resolved this issue by
Running Laragon as the administrator
and then
In Laragon's Menu > MySQL, you can:
Change your root password.
Press win key + R
write services.msc
Stop MySql
Run laragon from adminstrator.
Menu ---> MySQL---> Change root password
Related
I am using php mysqli_connect for login to a MySQL database (all on localhost)
<?php
//DEFINE ('DB_USER', 'user2');
//DEFINE ('DB_PASSWORD', 'pass2');
DEFINE ('DB_USER', 'user1');
DEFINE ('DB_PASSWORD', 'pass1');
DEFINE ('DB_HOST', '127.0.0.1');
DEFINE ('DB_NAME', 'dbname');
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if(!$dbc){
die('error connecting to database');
}
?>
this is the mysql.user table:
MySQL Server ini File:
[mysqld]
# The default authentication plugin to be used when connecting to the server
default_authentication_plugin=caching_sha2_password
#default_authentication_plugin=mysql_native_password
with caching_sha2_password in the MySQL Server ini file, it's not possible at all to login with user1 or user2;
error: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in...
with mysql_native_password in the MySQL Server ini file, it's possible to login with user1, but with user2, same error;
how can I login using caching_sha2_password on the mySql Server?
I solve this by SQL command:
ALTER USER 'mysqlUsername'#'localhost' IDENTIFIED WITH mysql_native_password BY 'mysqlUsernamePassword';
which is referenced by https://dev.mysql.com/doc/refman/8.0/en/alter-user.html
if you are creating new user
CREATE USER 'jeffrey'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
which is referenced by https://dev.mysql.com/doc/refman/8.0/en/create-user.html
this works for me
As of PHP 7.4, this is no longer an issue. Support for caching_sha2 authentication method has been added to mysqlnd.
Currently, PHP mysqli extension do not support new caching_sha2 authentication feature.
You have to wait until they release an update.
Check related post from MySQL developers: https://mysqlserverteam.com/upgrading-to-mysql-8-0-default-authentication-plugin-considerations/
They didn't mention PDO, maybe you should try to connect with PDO.
ALTER USER 'mysqlUsername'#'localhost' IDENTIFIED WITH mysql_native_password BY 'mysqlUsernamePassword';
Remove quotes (') after ALTER USER and keep quote (') after mysql_native_password BY
It is working for me also.
If you're on Windows and it's not possible to use caching_sha2_password at all, you can do the following:
rerun the MySQL Installer
select "Reconfigure" next to MySQL Server (the top item)
click "Next" until you get to "Authentication Method"
change "Use Strong Password Encryption for Authentication (RECOMMENDED)" to "Use Legacy Authentication Method (Retain MySQL 5.X Compatibility)
click "Next"
enter your Root Account Password in Accounts and Roles, and click "Check"
click "Next"
keep clicking "Next" until you get to "Apply Configuration"
click "Execute"
The Installer will make all the configuration changes needed for you.
Like many many people, I have had the same problem. Although the user is set to use mysql_native_password, and I can connect from the command line, the only way I could get mysqli() to connect is to add
default-authentication-plugin=mysql_native_password
to the [mysqld] section of, in my setup on ubuntu 19.10, /etc/mysql/mysql.conf.d/mysqld.cnf
It's working for me (PHP 5.6 + PDO / MySQL Server 8.0 / Windows 7 64bits)
Edit the file C:\ProgramData\MySQL\MySQL Server 8.0\my.ini:
default_authentication_plugin=mysql_native_password
Reset MySQL service on Windows, and in the MySQL Shell...
ALTER USER my_user#'%' IDENTIFIED WITH mysql_native_password BY 'password';
I ran the following command
ALTER USER 'root' # 'localhost' identified with mysql_native_password BY 'root123'; in the command line and finally restart MySQL in local services.
If you're on a Mac, here's how to fix it. This is after tons of trial and error. Hope this helps others..
Debugging:
$mysql --verbose --help | grep my.cnf
$ which mysql
/usr/local/bin/mysql
Resolution:
nano /usr/local/etc/my.cnf
Add: default-authentication-plugin=mysql_native_password
-------
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
default-authentication-plugin=mysql_native_password
------
Finally Run: brew services restart mysql
Now you can upgrade to PHP7.4 and MySQL will go with caching_sha2_password by default, so default MySQL installation will work with mysqli_connect No configuration required.
I tried this in Ubuntu 18.04
and is the only solution that worked for me:
ALTER USER my_user#'%' IDENTIFIED WITH mysql_native_password BY 'password';
If you have not yet already changed your MySQL default authentication plugin, you can do so by:
Log in as root to MySQL
Run the following SQL command:
a. if you are running MySQL in a different server:
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password
BY 'password';
b. if you are running MySQL in a different server:
ALTER USER 'root'#'%' IDENTIFIED WITH mysql_native_password
BY 'password';
I am using laravel 5.8 and having MAMP server got this error resolved by adding DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock in .env file like below
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=8889
DB_DATABASE=dbname
DB_USERNAME=root
DB_PASSWORD=root
DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock
In my case when I was using WAMP server I fixed it using following
Note the port in mySQL's "my.ini" file. In my case it was changed to 3308 when I was switching b/w MariaDB and MySQL DB.
Use the port number when you create mysqli object.
Using the above steps I was able to run the program successfully.
phpMyAdmin GUI way
Note: This method may not work if you have the problem with root user account.
Login to phpMyAdmin as root.
Switch to "User Accounts" tab.
Select the username you get error with.
From the top buttons, switch to "Login Information" section.
In "Login Information" box, change "Authentication plugin" from "Caching sha2 authentication" to "Native MySQL authentication". Also, you must fill in other required fields, obviously, including username and password.
Save it by clicking on the "Go" button at the bottom.
Return back to terminal and enjoy. :)
In my case, i'm using PHP Symfony framework and it's a silly mistake.
The database credential was wrong in paramers.yml.
After changing the credentials accordingly the problem was gone.
In Digital Ocean Managed Mysql, we have an option to change encryption, you can change to legacy and it'll work ok.
I think it is not useful to configure the mysql server without caching_sha2_password encryption, we have to find a way to publish, send or obtain secure information through the network. As you see in the code below I dont use variable $db_name, and Im using a user in mysql server with standar configuration password.
Just create a Standar user password and config all privilages. it works, but how i said without segurity.
<?php
$db_name="db";
$mysql_username="root";
$mysql_password="****";
$server_name="localhost";
$conn=mysqli_connect($server_name,$mysql_username,$mysql_password);
if ($conn) {
echo "connetion success";
}
else{
echo mysqli_error($conn);
}
?>
I want set password mariaDB. I don't know What to do.
How to set password MariaDB on XAMPP 5.6.21 for windows?
just go to phpmyadmin, tab Users, click the user you want to edit in Edit Privileges link
Use mysqladmin command to set password for root user. Please refer to this answer here
I have just install Postgres 9.3 on Windows 7. The installation completed successfully. It has never asked me to provide the password for postgres user.
The service postgresql-x64-9.3 is up and running. However, I cannot connect: I do not not know the password. I've found the following answer, but it did not help:
similar question on Ubuntu
[LINUX]
might work for windows too
After installing postgres follow following steps in order to setup password for default system account of Linux execute following in terminal:
user:~$ sudo -i -u postgres
postgres#user:~$ psql
after executing above two commands you will get into postgres shell
Execute this query in postgres shell:
postgres=# ALTER USER postgres PASSWORD 'mynewpassword';
your new password is 'mynewpassword' without quotes and now you can connect with external GUI tools like DBeaver
WARNING: trust means exactly that. Anyone who can connect to the PostgreSQL server can control it. If you set trust mode that allows superusers like user postgres (or all users) to connect, they get total control of your PostgreSQL and can probably run shell commands too. You should usually only use it to change the password then restore the configuration back to the auth mode you were using before.
If you used an unattended installer script, the password will be in the script or associated config file.
Otherwise, treat it the same as if you lost/forgot the password rather than never knowing it:
Edit pg_hba.conf, setting the auth mode to trust instead of the default md5
In the Services control panel restart the PostgreSQL service
Connect with psql or PgAdmin or whatever
ALTER USER postgres PASSWORD 'mynewpassword';
Edit pg_hba.conf again and set the auth mode back to md5
Restart PostgreSQL again
pg_hba.conf is in your data directory. By default it'll be %PROGRAMFILES%\PostgreSQL\9.3\data.
To edit it you'll have to use the security tab to give yourself read/write permissions (via a UAC prompt). This might require you to set yourself as the owner of the file.
On unix systems it's more secure to prepend a
local all all peer
line to pg_hba.conf and then sudo -u postgres psql (assuming your PostgreSQL server runs as user postgres) to get an interactive psql session without using a password. That way you don't have to use trust.
On initialisation you can access the DB as:
Username: postgres
Password: postgres
By default user postgres does not have a password
Start psql and create a password:
sudo -u postgres psql
\password postgres - It will ask you enter a password for user postgres
Through trial and error I found that the password for Postgre SQL 10 for the username postgres is "admin". I kept typing in different password until I reached that password. I am using pgAdmin 4 to test out my SQL Statements, POSTGRE SQL 10 is the first server connection set up using localhost.
It seems there was no default password, but psql wouldn't accept a lack of a password (fe_sendauth: no password supplied). To get around this, I opened pgAdmin, then in the left sidebar:
Servers
Login/Group Roles
Right click postgres and click Properties,
Go to Definition tab
Set the password in the Password field
After saving, psql accepted that password. There may have been a switch I could have supplied to have it accept a lack of a password (--no-password?), but the user should probably have a password anyways, so this seemed reasonable.
go to control >> computer management >> Locaol users and group >> users >>
right click on openpgsvc >> set password.
after that now you can access with this password on openpgsvc
The simplest solution I've found is just to install PgAdmin and connect to the local server with the current Windows credentials (username + password). Then you can change the password to the postgres user.
step1: Go to control panel
Step2: Click on Administrative Tools
Step3: Click on Computer Management
Step4: There under "Local Users and Groups" Double click on user
Step:5: then right click on postgres and you can set password
refer this below image
I got my new lion machine. Ran the PostgreSQL installer from the PostgreSQL site for Mac and i have no multiple apps installed. One of them is "pgAdmin III.app". When I open it there is already one server connection available. localhost:5432
Whenever I try to connect to the server with a doubleclick the programm asks me for a password. I have no idea what to enter. It's not my admin password, it's not "postgres", it's not "localhost", it's not empty.
I just can't seem to connect to the server. Even when I check the properties of the localhost server the password field seems empty. However I'm not allowed to leave the password field empty.
Any idea what to do? I really need to setup postgres?
On my Mac OSX Lion, PostgreSQL configuration files are stored under /Library/PostgreSQL/9.0/data/
Haven't tried it on OSX, but on Ubuntu you can login as the system user 'postgres' to the default database 'postgres' without a password with
su postgres -c psql
You can then (re)set the password of the database superuser 'postgres'.
You can also edit the configuration file pg_hba.conf (don't know where it is located on a default OSX installation, on Ubuntu it is /etc/postgresql/8.4/main/pg_hba.conf) and grant access to the default database without authentication
# TYPE DATABASE USER CIDR-ADDRESS METHOD
host postgres postgres 127.0.0.1/32 trust
After editing pg_hba.conf you must reload the configuration with
pg_ctlcluster 8.4 main reload
You can then connect with pgAdmin and (re)set the password, but don't forget to change the authentication method back to md5 again...
here's a better answer (works in OSX HighSierra): the account used is the one you're logged onto OSX with, therefore, the password is your password!
A similar question has been asked a short time ago. The steps described there should be appropriate for Lion also.
Postgresql: password authentication failed for user "postgres"
I had installed IBM DB2 Content Manager 8.4.1 months ago and now I wanted to access it to continue some more work.
But when I try to log in using System Administration Client, it tells me the password is expired. The error is:
DGL0394A: Error in ::DriverManager.getConnection;[jcc][t4][2012][11248][3.50.152]
Connection authorization failure occurred. Reason: Password expired.
ERRORCODE=-4214,SQLSTATE=28000 (STATE) : ;
[SERVER = icmnsldb, USERID = icmadmin, SQL RC = -4214, SQL STATE = 28000]
I've tried looking thru the config files, using the java update command line.. and I can't find a way to change or reset the password. I can't use System Administration Client to change the passwords, since it won't log me in to begin with. Any other method I can use to reset/change the password for a DB2 CM user?
DB2 uses the operating system to authenticate users, so you need to use the OS tools to reset the icmadmin user's password. Your post is tagged as Windows, so look for the icmadmin user in either the local machine or in the domain if your server belongs to a domain.
Just use the Client for Windows on a desktop machine and not the eClient to login. It will directly notify about a expired password and you can set the new password immediately.
I faced the same issue. I logged in as root and chaged the password for db2 user by passwd . and changed in the WAS console. It worked.
In Windows, click on start > Control Panel > User Accounts > User Accounts > Manage User Accounts.
Here, select the DB2 username and click on Reset Password.
If you are on Docker, you need to perform a docker exec into the DB2 container (Linux) and then change the password for the local user that you are trying to log in to DB2 with. In my case, the name of the user was "myuser". I changed the password by executing
passwd myuser
Note that you are root by default when you exec into the container. Else use
docker exec -u root <containerName> /bin/sh