I am new to MySQL. I have installed MySQL 5.6 in Windows 7 with user root and given password to it. But when I start MySQL Workbench and try to connect database, I am getting an error.
My try:
Connect to Database:
Connect to MySQL Server:
Error:
Then I tried to reset password with command prompt:
Please help me, I am new to MySQL, not getting what to do.
Thanks
It's possible that your setup is not listening for IP connections and is only listening on a local socket. Try:
mysql -u root
If you have already set a root password, try:
mysql -u root -p
on the command prompt. Or try removing the hostname from workbench.
You can resolve this issue using these steps.
1.open the terminal
2.exectute the command - sudo mysql -u root
3.then,execute - ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'new_password';(*replace the "new_password" with your new password"
4.exit;
5.now check the connection...It will work :)
It seems you do not have access for such task, exit the application and re-start it as administrator . Run As Administrator
Related
I'm trying to log-in to MySQL server with PHPMyAdmin but it does not work,
I insert true username and password but it still doesn't work and I don't know what's the reason
error:
mysql_real_connect(): (HY000/1045):Access denied for user
'root'#'localhost'(using password YES) Connection for control user as
defined in your configuration failed
can't enter to PHPMyAdmin
NEW Version of MYSQL does it this way.
In the new my-sql if the password is left empty while installing then it is based on the auth_socket plugin.
The correct way is to login to my-sql with sudo privilege.
$ sudo mysql -u root -p
Enter your database password and then updating the password using:
$ ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'new-password';
where new-password is your new database password or what you want
Once this is done stop and start the mysql server.
$ sudo service mysql stop
$ sudo service mysql start
Do comment for any doubt.
After completion of any .env edit, must be clear cache: php artisan config:cache
If you fixed everything and still have an error then stop XAMPP and restart Apache and MySQL server
I downloaded and installed mysql community server GPL version 5.7.13 on my Mac OSX El Capitan. Then I downloaded sequel pro. I tried to connect mysql using socket. I used the name localhost and username root and kept the password blank. When I tried to connect every time I got the message in the picture.
I also want to add, when I install mysql for the first time, there is a popup which gives me a cryptic password for the root#localhost. So instead of keeping the password section blank, I tried that password too. But it kept showing me the same message except 'root'#'localhost' (using password: YES). What am I doing wrong?
Start mysql server in terminal by:
mysql.server start
Access in mysql with your root user (deffault user created when installed mysql)
mysql -uroot
Create a new account by:
CREATE USER 'new_user'#'localhost' IDENTIFIED BY 'new_password';
Give it all privileges:
GRANT ALL PRIVILEGES ON * . * TO 'new_user'#'localhost';
Then to reload newly assigned permissions run:
FLUSH PRIVILEGES;
Now you should be able to connect with Sequel Pro with new user:
Standard
Host: 127.0.0.1
Username: new_user
Password: new_password
I use Sequel Pro and connect without password to a localhost server via socket, without any problems. The most likely problem is you typed in the wrong root password. You can reset the root password.
Make sure MySQL is running (start MAMP/XAMP servers)
MAMP uses "root" for the username AND "root" for the password
Use 127.0.0.1 instead of 'localhost'.
Uninstall it and again install. Give the root password at the time of installation. It worked for me.
You will need to restart mysql after changing password, password can be and is in many cases blank, empty carriage return.
the easiest way to restart mysql I have found is by command line
mysql restart;
I am facing this error every time I create a database in CLI interface of mysql:
I am using Xampp
You may need to set up a root account for your MySQL database:
In the terminal type:
mysqladmin -u root password 'root password goes here'
And then to invoke the MySQL client:
mysql -h localhost -u root -p
more reference Reference
A simple and 100% working solution for this problem is:
Install Xampp outside the C: Folder and it will definitely work for you, without any permission problems ever.
But remember to provide xampp-control.exe administrative privileges always to terminate any port problems.
I've installed mysql5 using Macports and the installation appears to check out but I cannot login to the server at all.
This is what I did:
sudo port install mysql5-server
This builds and installs fine.
sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql
This runs fine as well. It outputs the following:
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:
/opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password'
/opt/local/lib/mysql5/bin/mysqladmin -u root -h LeoMacBook.local password 'new-password'
Alternatively you can run:
/opt/local/lib/mysql5/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 /opt/local ; /opt/local/lib/mysql5/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /opt/local/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /opt/local/lib/mysql5/bin/mysqlbug script!
Now...let's follow the instructions exactly. I start the server:
sudo /opt/local/lib/mysql5/bin/mysqld_safe &
Server is running fine.
When I try to change the root password, I CANNOT log in.
LeoMacBook:bin leonardteo$ /opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password'
/opt/local/lib/mysql5/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'#'localhost' (using password: NO)'
I'm at wits end.
I've started the server with --skip-grant-tables. With this, I can load up mysql fine from the command line and I'm connected to the server. When I run SELECT * FROM mysql.user;, it returns an empty set! With this, I've tried to create a new user by invoking the command:
CREATE USER 'root'#'localhost' IDENTIFIED BY 'root';
But this doesn't work. I get the error:
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
I cannot get this working. It seems I am so close, yet the root user seems to be missing.
Any ideas?
Leonard
Once you've started up mysql with --skip-grant-tables, issue a flush privileges; query. This'll re-enable the permissions system and allow you to run the usual grant and create user queries.
I'm working through tutorials in the book 'Cloning internet apps w/ Ruby.' I've made web apps before but they depended on sqlite and now I have to use mysql.
I've installed community server but when I try to create a database using the command line I'm receiving the error message listed above.
$ mysql
mysql> create database tinyclone;
Returns
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'p'
Notes:
The mysql command-line client flashes open and immediately closes, so I'm accessing it from the command prompt.
I've installed and uninstalled mysql several times in attempts to figure out this problem. In the latest install, I didn't set a password.
I'm aware that this line should probably be '$mysql -u <username> -p <password>' but I didn't set a password and I'm not sure what the username would be.
By default, the user is root
If you havn't set a password, use $ mysql -u root
The default MySQL username is 'root', try that without a password
The default username for MySQL is root, so you can try by
$ mysql -u root
by default it logs you with your Linux account. If you're logged as root on your Linux machine it will be OK just using $ mysql