How to create localhost database using mysql? - mysql

I download mysql installer here:
http://dev.mysql.com/downloads/installer/
And then I downloaded MySql WorkBench.
At workbench's connection configuration I put hostname as "127.0.0.1", port "3306", user: "root", password is empty. I click "test connection" and it gives me this error:
"Can't connect to MySQL server on '127.0.0.1' (10061)"
What am I missing?

See here for starting the service and here for how to make it permanent.
In short to test it, open a "DOS" terminal with administrator privileges and write:
shell> "C:\Program Files\MySQL\[YOUR MYSQL VERSION PATH]\bin\mysqld"

Consider using the MySQL Installer for Windows as it installs and updates the various MySQL products on your system, including MySQL Server, MySQL Workbench, and MySQL Notifier. The Notifier monitors your MySQL instances so you'll know if MySQL is running, and it can also be used to start/stop MySQL.

removing temp files, and did you restart the computer or stop the MySQL service? That's the error message you get when there isn't a MySQL server running.

Related

Unable to Access MySql 8.0 Database from Remote Windows Server

I have Installed MySql 8.0 Version in a windows
server and able to connect via WorkBench/MySql shell locally.
I would like to access MySql from a remote windows server.
Here are the things I have tried.
1) Created root#% user and Grant full access to the new user.
2) Created a new user as test#'remoteserveripaddress' and Grant full access to the user.
3) Opened port 3306 on Both Remote and MySql server.
4) Added "bind_address=*" in my.ini file and restarted the MySQL80 Service.
I am running out of options.
Error: I am getting below error
Failed to connect MySql at UserName#hostipaddress:3306
SSL connection error: error:00000000:lib(0):func(0):reason(0)
No matter how many different ways I try.
Not sure what am I doing wrong ??
Try to execute below command in your terminal :
mysql -h server -P 3306 -u root -p
If you successfully connect to your database, the same thing has to happen with Mysql Workbench.
If you are unable to connect then I think 3306 port is acquired by another process.
Find which process running on 3306 port. If required, give admin privileges using sudo.
netstat -lnp | grep 3306
Kill/stop that process and restart your MySQL server. You are good to go.
Execute the below command to find my.cnf file.
mysql --help | grep cnf
You can change MySQL port to any available port in your system. But after that, make sure you restart MySQL server.

Can't connect to database (10061)

I have a Raspberry Pi (first model) I use as a server. I followed a tutorial and installed Apache2, MySQL, Phpmyadmin etc.
I have also set up a ddns for my home network to be able to connect to it wherever I am, and of course forwarded the necessary ports.
At first everything worked wonders.
I could connect to the database using phpmyadmin by navigating to adress/phpmyadminfrom any network.
I could also use HeidiSQL to connect to the database, again from any network.
The MySQL version I had at this time was v5.5. I wanted a feature available on v5.6 but this version was not available on my RPi (ARMv61). Instead it seemed like MariaDB should do the trick. So I updated to MariaDB using the command:
sudo aptitude install mariadb-server
Now I am not able to connect through HeidiSQL anymore, Phpmyadmin still works though from any network just like previously. Trying to connect with HeidiSQL I get the output (no matter what username/password i try):
Can't connect to MySQL server on 'adress' (10061)'
mysql -V gives output:
mysql Ver 15.1 Distrib 10.0.27-MariaDB, for debian-linux-gnueabihf (armv7l) using readline 5.2
My RPi info is
Linux redface 4.4.26+ #915 Thu Oct 20 17:02:14 BST 2016 armv6l GNU/Linux
The user privileges are available in the image below
How can I connect to the database again using HeidiSQL? Have I missed something with the user privileges?
With phpmyadmin I use the username root
This particular error is not about permissions.
The code (10061) is WSAECONNREFUSED -- a Windows socket error code for Connection refused, not to be confused with "access denied."
Connection refused typically means no service is listening on the target IP address and port. MariaDB is not listening on 0.0.0.0:3306.
mysql -V only tells you the installed client version -- it doesn't tell you anything about the MariaDB server.
Access to phpMyAdmin doesn't tell you anything, either, because with it, you're not talking to the database server remotely -- you're talking to your web server remotely, and your web server is running code that talks to the database locally from within the same machine, and often uses a different mechanism of server access that is not TCP/IP.
Check the config file for a commented-out bind_address=0.0.0.0 or similar.
https://mariadb.com/kb/en/mariadb/configuring-mariadb-for-remote-client-access/

server migration and could not connect to mysql

I have a Centos 5.5 Server and needs to migrate to a new one with 6.6. I have about three websites, a third party application(service). I need to put all these to my new server and host the websites.
And In the new machine i am not able to connect to mysql, when i try to connect using
mysql -u root the below error is shown.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Please suggest how can i connect with mysql and the migration? I am new to this.
I have tried to change the password using skip grantables and again the result is same.
If you are using plesk 11 then try to login your mysql shell with the following command
mysql -uadmin -p`cat /etc/psa/.psa.shadow`

Cannot Connect to Database Server mysql workbench

I'm trying to connect to mysql workbench but I get the following error
Error Message
Cannot Connect to Database Server
Your connection attempt failed for user 'root' from your host to server at
127.0.0.1:3306:
Could not open database.
Please:
1. Check that mysql is running on server 127.0.0.1
Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines)
Make sure you are both providing a password if needed and using the correct
password for 127.0.0.1 connecting from the host address you're connecting
When I Test Connection, the parameters are correct, and actually I can enter and manage database in console.
When I installed Mysql for first time I could enter to Workbench one time and if I closed Workbench I had to restart my PC to connect another time.
I reinstalled 2 or 3 times Mysql server and Workbench and now I cannot connect from Workbench even once.
I faced similar issue and resolved it by following these steps:
In the terminal, execute this command
mysql -u root -p -h localhost -P 3306
Enter the password
This will be displayed
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 8.0.16 Homebrew
Now do,
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
Now you should be able to login and connect to DB in the workbench with password 'root'
I don't know if it helps anyone, but I had the same problem on windows after updating from MySQL 5.7 to 8.0.
The solution for me was to go to services.msc, stop the MySQL service and start the "MySQL80" service instead.
Then I restarted MySQL Workbench (run as admin) and it worked.
Please make sure that You have Downloaded MySQl server while dowloading MySQl workbench from MySQl installer (if you have checked Custom download)
I had the same issue a few days ago. As I could see in the original question, there has been multiple MySQL installation on the same computer - the same flow I tried after failing in the first attempt.
In the case we are trying to reinstall MySQL, we should be aware of remaining hidden files after MySQL has been uninstalled for the first time. In order to remove them all (and make one successful installation), we should:
Make hidden files visible on your computer (instructions)
Delete all files related to MySQL after choosing uninstalling of the MySQL (I had to check C://ProgramData hidden folder)
Try a new installation
I think that during the first installation, I didn't have all required dependencies on the computer (for example Python) and the installation failed. After installing it, uninstalling the MySQL, and taking steps from above, I finally managed to run it successfully :)
I hope this could help someone! :)
This solved it for me (MAC OS)
Open MySQL from System Preferences > MySQL
Click 'Stop MySQL Server' if the server is running
Select 'Initialize Database'
Type your new password.
Choose 'Use legacy password'
Start the Server again.
Now connect the MySQL Workbench

How to create a new Server Instance on MySQL Workbench 5.2.25 CE

I've just setup MySQL Workbench 5.2.25 CE on a PC with windows XP service pack 3
When trying to create a new server instance on the localhost, Workbench ask me for a root password regarding the service. I've have not been asked during the setup process to enter a password for root... leaving the password blank (or even inputting a 'fake' password) leads to the folowing error message :
'Connecting to MySQL server localhost...
Can't connect to MySQL server on '127.0.0.1' (10061)'
Using a cmd box and trying to log on mySQL as root (mySQL -u root) I have also the following error : ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
The setup of mySQL went fine and I was not asked for anything... did I something wrong ?
I know this is an old question but ...
Take a look at the my.ini file, If there is a default user/password. use that. If this is set mysql will use this.
You can also try
mysql -uroot -p
if the password is really blank then this will let you in