SQL database connection problem - missing databases - mysql

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.

Related

Cannot preform mysql query from ubuntu terminal

What I'm trying to do:
I have a Minecraft server, I'm trying to my an admin panel so the other admins can help out the server more closely.
Right now, I am trying to make a live console. My thought was is that if I have a script fire off every 10 seconds the script would perform a MySQL query and upload the log file contents to the Database and then on the webpage is would display the rows.
What I have tried:
So I looked on StackOverflow and you can query MySQL databases from the Ubuntu terminal and I have tried that.
mysql -u username#Database -pPassword -h azure.database.for.mysql.url -P 3306 -D SchemaName
It does not work as I get an error
ERROR 1045 (28000): Access denied for user 'username'#'machineIp' (using password: YES)
There were people saying to edit the configs and comment out "bind-address" however it seems to only apply to the machine the MySQL server is on, and not the one performing the queries.
Things to note:
The Web Server, Minecraft Servers, and MySQL Server are all on different machines.
The MySQL server is a SaaS provided by Azure.
I use this database for my web server and it works fine in connecting to the server so I believe it is not a MySQL server issue.
I also use this database for my Minecraft permissions plugin and it connects fine.
If you have more questions please ask and I will do my best at answering them.
It looks like its not accepting your password.
This is the format that I use to access mysql from terminal.
mysql --prompt="(\u#\h) [\d]> " --user=your_username --password your_password

Mysql Server does not require password to access and edit databases

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.

Mysqladmin (and mysql) can't access database using subdomain

I have a remote mysql instance (not on the local machine, but on the same subnet as my testing platform) that I'm using for testing. So that I can mimic the real database in the application, I've modified /etc/hosts with the following two entries:
192.168.1.249 macduff
192.168.1.249 dc2-mysql-01.kattare.com
Everything works fine when I attempt to access the database remotely using
mysql -h 192.168.1.249 -u myusername -pThePassword
and
mysql -h macduff -u myusername -pThePassword
However, when I use
mysql -h dc2-mysql-01.kattare.com -u myusername -pThePassword
The mysql monitor seems to connect, but it then hangs. It prints the usual password warning but doesn't print the Welcome to the MySQL monitor message, for example. The monitor also doesn't respond to any input. I'm assuming that I've got the user set up properly, given that I can access the instance using the IP address and the single-word alias. I have a single % as the host name associated with the user. If it matters, I'm using a Homebrew install of mysql 5.7.12 on a mac running El Capitan on both the local and remote machines.
MORE INFO:
Just tried creating a user with the dc2... address listed explicitly as a host, but that didn't help (which seems to imply that this isn't a CREATE USER or GRANT issue). I let mysql run for a while, and eventually something timed out and I got a
ERROR 2003 (HY000): Can't connect to MySQL server on
'dc2-mysql-01.kattare.com' (60)
Which implies a DNS problem, but the dc2... address works fine in the browser, so it appears to be something mysql related. DNS in mysql is enabled (it recognizes the single-word alias macduff without difficulty).
Any idea what's going on?

remote mysql access showing different database list

I found a weird problem that when I connect to my database which locates at another server, the output of show databases; was different with that when I did local.
My database was running MySQL at IP 10.200.0.11, I connect with mysql -u username -p -h 10.200.0.11
I did some search, seems no people reported this problem? Did my mysql client cached something? I tried another client machine, and it works good through.
Any thoughts? Thanks in advance.

Unable to login to MySQL instance hosted on AWS ec2

I am trying to set up a mysql database on an aws ec2 instance (SUSE 32-bit with mysql pre-installed). However, I can't log in to mysql as root user:
mysql -u root
Access denied
without a password, so is there a way of getting one? I believe that root user is blocked and hence should login with ec2-user. However, when I do
mysql -u ec2-user
the user does not have the priviledges to create a database.
I'm a not very familiar with linux, so if I'm simply doing this completely wrong, then do say.
Any help would be greatly appreciated.
The fact that this server is on EC2 is irrelevant. SUSE and MySQL do not know this. Amazon cannot block anything, you have root access to the server. You recover/change the root password the same as any server, with mysqladmin, or by starting mysqld with --skip-grant-tables while you make the change.
mysql -u root -p
Then press enter.
I know, this isn't a direct answer to your question, but I would recommend using the AWS Relational Database Service. Amazon will host a MySQL database for you and take care of all the setup, maintenance, scaling, backup, etc.
http://aws.amazon.com/rds/