Currently running Ubuntu 18.04.2 and have a freshly installed MySQL server 5.7.26-0ubuntu0.18.04.1 running on my server. My problem is that when I connect to mysql through mysql -u root -p the password I set up through Secure Setup works but then if I type in any random string then that works also. Which leads me to think that it did not work. Additionally, I can login to the mysql server through mysql and mysql -u root.
Related
I am quite stressed, I am afraid I have lost my databases. I wanted to access my database from another laptop, but I finally lost the connection to my databases, and when I found it again, my databases were gone.
I hope you will be able to help me or perhaps have some encouraging leads.
I wanted to access my database from another laptop, so I tried to change my hostname from "localhost" to my IP address on MySQL Workbench. This way I could not connect to MySQL, I tried to change my hostname back to "localhost" but I could not connect either.
Finally, since I'm on a Mac, I went to System Preferences > MySQL > Initialize Database, and changed to use legacy password encryption, as suggested in a tutorial. Then I can connect to the server, but there are none of my databases, just the original "syst" database.
Are you able to connect to your MySQL via command:
mysql -u username -ppassword (no interval after -p)
(bear in mind that you have to be in the bin dir of MySQL) for example using XAMPP in cmd, I can connect via the following commands:
cd C:\xampp\mysq\bin
mysql -u root -ppassword
If you are able to connect try to reach the database via command line like this:
mysql -u username -ppassword --execute="select * from databasename.table"
or just some other query just to check if the database is still there.
This should be done on the PC(or server) where the MYSQL is installed.
If this is working you can manage to fix the issues.
I have heroku app running using a Jaws Maria db as a add on, I want to access the database using xampp's mysql on windows 7 machine. I got my database url via
heroku config:get JAWSDB_MARIA_URL --app MYAPPNAME
which got me a string like
mysql://username:password#serveraddress:3306/dbname
i'm trying to access this database url via the command from my cmd
E:/xampp/mysql/bin/mysql -u username -h serveraddress.amazonaws.com -P 3306 -D dbname -p
accoring to the thread Access mysql remote database from command line
after providing the password im getting an error
Can't connect to MySQL server on 'serveraddress.amazonaws.com' (10060 "Unknown error")
Whereas if i try to connect to ths database from c9.io I can access it using the command
mysql -u username -h serveraddress.amazonaws.com:3306 -p
Can anyone help me so that I can access it from xampp's mysql in windows as well. Cant figure out what am I missing here
I have a MySQL server installed in a remote Ubuntu VM that i access using a VPN and i have some sql scripts that i want to run on that server, to create new Stored procedures and queries.
The the details of the virtual machine are:
IP: 192.168.58.61
Hostname: les12a.fi.fr
I am using putty and i am writting directly the commands, but i would like to run directly a script that is on my Windows machine.I have tried using Source, and path but this works fine when MySQL is on my machine. What is the correct syntax to do that on remote server?
just do:
shell> mysql -u user -p -h HOSTNAME DBNAME < yourscript.sql
HOSTNAME: put the hostname if could be resolved or the ip of the remote server
enjoy
SSH to your server, and then run:
mysql -u USERNAME -p DATABASE_NAME < scripts.sql
Obviously, your scripts should be stored in scripts.sql, which should be in your working (current) folder.
I've installed the mysql community server, server is running, and i'm able to connect through command line using
mysql -u root -p -h 127.0.0.1 -P 3307
which is the community server. I've also installed wamp which has its mysql server running on port 3306, the command above also connects to that server again
wamp is running fine and i'm able to get into phpmyadmin just fine, but when i try connecting to either mysql server through localhost using workbench, i'm presented with an error "Failed to connect to MySQL at 127.0.0.1:3307 with user root
Unknown MySQL server host '127.0.0.1' (0)"
I've been searching online for hours now and i can't seem to find any solutions to this. The only problem i'm having is connecting through workbench.
Are there any settings for workbench that i might have to change in order to connect to the servers?
EDIT:
This is all on windows by the way. I've also reinstalled wamp, workbench, and mysql server multiple times
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