Error connecting to SQL host, PHP Script: PHPVALLEY Microjob Script - php

I installed the php script and all wen well but the problem is at the final step, when I need to fill the database information, when I field the database information I find that i am getting an error that says "Error connecting to SQL host", so I try and try in different ways but there is no solution, nevertheless, I installed the same script on my localhost and all went well without problems, my Hosting Provider is: Siteground
Filling Database Information Image
Showing the Error Image

You must grant write permissions to the connect.php file for the user who is running the web service for example apache.
Have you ssh access to the server?

If your application cannot connect to the database you should make sure that:
Your application is using the correct MySQL hostname: localhost
Your application is using the correct MySQL database / username /
password.
Don't forget to specify your MySQL username and database with the
prefix yourusername_ in front of its given name. For example, your
cPanel username is siteground and you have named your database
joomla. In this case you have to refer to your database as
siteground_joomla;
Source: https://www.siteground.com/kb/my_script_cannot_connect_to_my_database_/
Another good idea would be to try to use your cPanel username and password for the Database User and Database Password. This will rule out whether you have granted all privileges to your database user.
Also you should change the permissions of your connect.php file to 755, as if you set them to 777, this will cause an internal server error.

Related

Cannot select database during wordpress local setup

I have installed wordpress and I am trying to connect database. I am seeing this error:
Cannot select database
The database server could be connected to (which means your username and password is okay) but the database could not be selected.
Are you sure it exists?
Does the user root have permission to use the database?
On some systems the name of your database is prefixed with your username, so it would be like username_. Could that be the problem?
If you do not know how to set up a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.
I have checked that Database name, username and database host are correct but still I am not able to solve the error. I have tried using 127.0.0.1 but still no success.
The user needs to be given permissions to access the database.

Database connect not successful TYPO3

I am working for the first time on one hosting with TYPO3, and seems that I can't connect to database during initial setup (first install). My username and passwords are correct, and I can access to database using other methods but i simply can't with TYPO3 install tool. I tried with default hosts (e.g. localhost and default 127.0.0.1) and even socket based connection but nothing.
Any help please?
Best regrads
I had a similar problem on my local development machine. The solution for me was to comment out the skip-networking line in the MySQL server configuration file my.cnf
At first localhost or 127.0.0.1 will be successful as long as the mysql server is located on the same server.
Either you can create an special typo user for the server and bind it to an DB or you can use the default root user. Any other user also migth work depending on the configuration. Here you should check the accessrigths for the user u want TYPO to log in as.
For the password section you have to check if the user needs a password. If not just omit it.
Also try to select an empty but existing database
The connection type is not really relevant cause most of the problems are caused by wrong host,user, password, database settings.

Where is /usr/local/lib on online server

I have a server hosted on 000webhost.com
In the file manager there is a public_html folder where I store my website files, but no \usr folder.
Generally I could just access this file through the command line or terminal but this is not the case on this server. Unless there are command line tools that I simply couldnt find (I know it is a linux server);
I ran phpinfo() and the configuration file path was in usr/local/lib but I have no idea how to access that.
Any ideas? Thanks in advance.
Go to http://www.000webhost.com/faq.php look at the section on connecting to MySql. Your solution is likely there.
Here is a synopsis:
If you cannot connect to MySQL server, there could be some causes:
- Incorrect MySQL hostname.
Never use 'localhost' as your MySQL hostname! You can find your MySQL hostname by logging on to members area, entering control panel and clicking on MySQL icon.
- Incorrect MySQL username / password or database name.
You can find / setup MySQL username and database by clicking on MySQL icon from control panel. And you can change MySQL password by clicking on phpMyAdmin icon.
- Database failed to setup.
In a very rare cases MySQL database can fail to setup. To confirm this, please try to enter phpMyAdmin for any database. If you see database there, that means it setup was successful. And if you get access denied error by trying to enter phpMyAdmin, please delete the database and setup the same MySQL database again.
Please note that always you must give about 1 minute for any changes to apply on server.
If you still unable to connect to MySQL you check if it is server or your script problem in this way: if you can enter phpMyAdmin and see you database there, that means everything is working fine on our side. It's a problem with your PHP script.

Why does MySQL always give error access denied even though user exists?

I'm trying to simply run php artisan migrate --seed on a new Laravel project but everytime I try, I get the error:
SQLSTATE[HY000] [1045] Access denied for user 'appuser'#'localhost' (using password: YES)
I check my database config file and the correct username and password for the database are there.
I check MySQL Workbench, and the correct user is there with all the schema privileges for the same password.
I tried adding the user with privileges under %, localhost and 127.0.0.1 but same access denied error.
I ran a quick check to make sure Laravel was selecting the right environment for the database connection details and it is.
I've created users hundreds of times and never had this problem. This all started after I updated to the latest MySQL Workbench 6.1.7 after the older version stopped working correctly on Windows 8. Sadly, I don't have the option to even go back and test if the old version fixes the problem since it won't work at all.
At this point I can't get any new database users to connect.
The database server is up and running, and every other previously existing user still connects just fine.
Here is the my.ini file.
Any ideas? I'm hoping I'm just tired and missing something obvious here.
by reading the config file.
[client]
password = mysql
port = 3306
socket = "{$path}/mysql/mysql.sock"
i think you need to comment the string with default password. Probaby it affects something.
I have recent MariaDB, and the password string is commented out in every config file example

PHP 5.4 old auth on shared server, fixing without editing the mysql server

I just upgraded my developement box's PHP to the latest version, 5.4.5. This developement machine connects to a remote MySQL server, residing on a shared server that I lease from a hosting company.
Trying to connect to my remote MySQL server using simple mysql_connect('myserver.com', 'user', 'password') results in the following error:
Warning: mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file in file.php on line 2
Simply, as advised, just executing:
SET PASSWORD = PASSWORD('my-password');
wouldn't change anything.
The same applies when executing
SET SESSION old_passwords=FALSE;
After a bit of searching, I realized that I needed quite deep access to the MySQL server to be able to fix this problem, which I do not have. Trying to execute this query:
UPDATE mysql.user SET Password=PASSWORD('my-password')
WHERE User='my_user' AND Host='my-server';
FLUSH PRIVILEGES;
Simply gives me the following error:
1142 - UPDATE command denied to user 'u0112918'#'www10.aname.net' for table 'user'
Requests to have the company execute the query for me has, so far, been unsuccessfull. So my question is if there's any way to fix this on the client side, without involving the MySQL server?
Hm, try executing the following query through a tool other then PhpMyAdmin, such as Mysql Workbench or through a shell:
SET SESSION old_passwords=0;
SET PASSWORD = PASSWORD('passwordString');
You should be allowed to change your own password without DML Rights on user-table.
Edit: since it did not resolve the issue - when "read_only" is enabled for the database then you need super rights to change (even your own) password ( http://dev.mysql.com/doc/refman/5.5/en/set-password.html )

Categories