I am using LAMP on localhost. I can login which uses mysql db, get to the main page (data driven), but when i enter this particular page, its fine, but when i refresh the error is "No Database Selected" then one every page says so.
I restarted the Apache, MySQL server
Browsers FF,IE, Chrome all show the same errors, cleared cache too. At the same time other websites that use the same LAMP server works fine.
Now thats strange
All ideas are welcome.
Are the main pages using mysql_select_db("foo") and this particular one not?
When you are connecting with php, you are not selecting a database (or the select is failing). Is it perhaps using a variable which is not getting properly populated?
Somewhere in the code (PHP) the default database gets reset, probably on a shared database connection. I guess this is a bug in the product you use.
Try going through the code where it connects with database and tries to pull the data. Most of the times there is a configuration file which defines the connection attributes like username, password, database server, port and database to be used also.
for example in phpMyAdmin keeps the information in libraries/Config.class.php file.
Related
I'm writing a new project that utilises MySQL , There is no problem with the app I'm working on, but when the app recives the output from my sql server it immediately rejects it as null. When accessing my SQL server on port 3306 I am getting strange garbled messages back as well as the short message 'packets out of order.' In my setup I have, MAMP, Docker, Apache server and PHP. I can access each service on its respective port just fine.
1) I have looked into this by running console in the browser which reports the text being incorrectly formatted to something that isn't utf-8
2) I have followed this guide
https://medium.com/#manish_demblani/breaking-out-from-the-mysql-character-set-hell-24c6a306e1e5 and the results that my sql server have churned out are as follows
enter image description here
My question is this. Why is MySQL set up in this strange fashion? Why is it presenting in CP850 /DOS/ Latin? Are there no defaults/config files to change or is it done through windows somewhere
It seems you somehow messed up the client configuration (connection string, [client]-section of your cnf file (on the system that you started the mysql console on), ...). It tells your server to send data in cp850. Not sure why you would get packets out of order, maybe you have an additional underlying problem (very old library maybe?), but I'd start there. It's unclear: did you follow the blog post and then had problems, or was that a solution attempt? In any case, try to focus your attention on the client. Try to undo changes you made. MySQL uses utf8 by default for a long time now. – Solarflare
I am trying to get Wordpress up and running but I get the "Error establishing a database connection" page pop up.
Here is the setup and what I've done:
I have a server running Wordpress fine. I took a snapshot from the AWS volume that had the wp-config.php information from the running server and spawned a new server with a volume that is snapshotted. I've checked all my settings and it all looks fine.
On the SQL sever side (MYSQL), I added the new IP with all the correct username/passwords so the database server will allow it to connect. I also have put print statements while wordpress tries to load the database. The values returned are all correct. Based on some threads I read, I also deleted my wp-config file and re-copied it from the original server.
I also made sure the permissions are correct. Any other suggestions on what I could be missing?
I was able to fix this. The issue had nothing to do with Wordpress or the server, but with MYSQL. The database have Schema privileges and I hadn't set it for my new IP address. Adding the privileges fixed the issue.
i've setup a new mysql user on a server that allows access from other servers. i can access it from my dev machine using the credentials i setup.
But on one of my other servers nothing happens when trying to log into mysql using the same credentials that worked on my dev box. any ideas what it might be?
all it does is hang.
Nothing gets added to log files on either the new DB server or the one i'm trying to access from.
i also tested this connection from another server, just to test if my dev box was a fluke andi could access. So all i can think is there's something "wrong" with the server i cant access from.
Please post your query that executes to create this user and privileges.
If you can’t remember the queries you can execute this in your target server to get details about user
SHOW GRANTS for 'root'#'localhost';
You may check these things also .
Firewall setup for the server from the trouble machine.
Can this machine connect to another sql server provided with similar access?
Execute select * from mysql.user ; and check you don’t have duplicates with
different access privileges or passwords .
turns out i had everything setup correctly, as i said i was able to use the same user across other servers just not this one.
turns out my server provider had a network firewall restricting mysql connections. removed and hey presto.
thanks #csf
I'm trying to connect to our SQL Server box from our web server. The only thing i've been able to find regarding the issue is to enable tcp/ip and mixed authentication.
TCP/IP is already enabled
Mixed authentication mode is selected
we already have 1 user successfully connecting to a different database so I know TCP/IP and mixed authentication are working.
Logging in as the problem user from sql manager works fine.
I get the same error creating an ODBC connection as well as a ColdFusion SQL Server data source.
According to the log files, which isn't logging all the attempts also indicates State 40, which is "Default database could not be accessed (SQL 2008)."
I've check and the default database is the one I want to open. The Schema is DBO.
Any help would be appreciated.
Make sure your user password not longer than 16 characters.
I apologize for not answering this sooner. To be honest I completely forgot about the question until I got a 'Notable Question' badge from it. Unfortunately, I'm afraid it won't help anyone as the problem was caused due to bad information from the network admins. They moved our SQL server to another box but did not shut down the old instance. Essentially, they gave me the old IP to connect to. Once I got the correct IP to the new box everything worked perfectly. The user I thought was connecting was an older account that was already established prior to the 'move' so the account existed on the old box.
If your box has multiple IP's on it, make sure the Cold Fusion server's IP address (that it's binded to) is allowed access to the SQL box. I've come across this problem in the past. I don't know if you're using a firewall or not to restrict access...but this was a problem I've encountered in the past.
Actually I'm having more than one problem...but all of it has to do with connecting or working with the MySQL database...First you can see one of the errors on my website and no matter what you choose it seems to just say it can't connect to the database...I've configured a configure.php file to allow files to connect to the MySQL database...see the website here:
http://netsurfer123.byethost11.com/index.php
Then when I try to log-in to the Admin area of my MySQL database it just says:
phpMyAdmin - Error
Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.
Please let me know what I can do to correct these errors...and thanks very much in advanced for any helpful response/s.
First you need to check if the MySQL server is actually running. Use a command such as
/etc/rc.d/init.d/mysqld status
Or similar for your system if possible.
Did you check the web server log file? Does it contain errors as indicated by phpMyAdmin?
Your site is simply unable to connect to the database to which it's trying to connect. This could be for any number of potential reasons:
Is the database running?
Is the database accessible by that machine? (Maybe there's a firewall in between the two servers, if they're separated?)
If the database is on that same machine, are you connecting to it properly? (Maybe it allows only certain connection methods, such as a socket vs. the loopback address?)
Is your connection string correct? Maybe the login is failing?
Check your PHP logs, your Apache logs, your MySQL logs. One of them is complaining about something and it's probably trying to tell you what.