Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kikter's avatar

laravel project not connecting to database on shared hosting

I moved my project to shared host and it's not connecting to database , I have setup the env file and I am still getting this error

SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password

$response = $kernel->handle(

    $request = Request::capture()

)->send();

env

DB_CONNECTION=mysql
DB_HOST=127.0.0.1:8000
DB_PORT=3306
DB_DATABASE=insitmrxtr*****
DB_USERNAME=insitmrxtr***
DB_PASSWORD=Te*****
0 likes
30 replies
kikter's avatar

also when I tried to import my database SQL to phpmyadmin on shared hosting I got this error also please guys I needed your help

Error
Static analysis:

11 errors were found during analysis.

Unexpected character. (near "{" at position 345)
Unexpected beginning of statement. (near "doctype" at position 2)
Unexpected beginning of statement. (near "html" at position 10)
Unexpected beginning of statement. (near "html" at position 17)
Unexpected beginning of statement. (near "lang" at position 22)
Unexpected beginning of statement. (near ""en"" at position 27)
Unexpected beginning of statement. (near "dir" at position 32)
Unexpected beginning of statement. (near ""ltr"" at position 36)
Unexpected beginning of statement. (near "head" at position 44)
Unexpected beginning of statement. (near "meta" at position 53)
Unrecognized statement type. (near "charset" at position 58)
SQL query:

<!doctype html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="referrer" content="no-referrer"> <meta name="robots" content="noindex,nofollow"> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> <style id="cfs-style">html{display: none



MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '<!doctype html>
<html lang="en" dir="ltr">
<head>
  <meta charset="utf-8">
  ...' at line 1
Sinnbeck's avatar

You should remove the port from the host

DB_HOST=127.0.0.1
DB_PORT=3306

And the error shows the wrong user. Can you run php artisan config:clear

kikter's avatar

after deleting removing the db_port and running config:clear the website is now blank

kikter's avatar

@Sinnbeck

26 C:\Users\ADEALA\Desktop\tribe forum\tribe\vendor\laravel\framework\src\Illuminate\Console\Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#27 C:\Users\ADEALA\Desktop\tribe forum\tribe\vendor\symfony\console\Application.php(989): Illuminate\Console\Command->run(Object(Symfony\Component\Con
Sinnbeck's avatar

@kikter c:? You website host uses windows? Not sure what you are trying to show here?

kikter's avatar

@Sinnbeck sorry the log file is too long , how can I get the recent log activity

kikter's avatar

@Sinnbeck done that , after visiting the website I went back to check the laravel.log file but there was nothing in the file

Sinnbeck's avatar

@kikter it might be a permission issue. Does the web host have any sort of logging you can access.

Or try setting APP_DEBUG to true

kikter's avatar

@sinnbeck the blank space was due to white space in the env file I have corrected and we are back to the old issue again

SQLSTATE[28000] [1045] Access denied for user 'insitmrx_tribe****'@'localhost'
kikter's avatar

@sinnbeck i deleted the user and recreate it and it works , but the issue not is the SQL file I was unable to import due to the error I am getting

SQLSTATE[42S02]: Base table or view not found: 1146 Table
Snapey's avatar

your database backup file contains html, so it's not an export from your database and cannot be imported

kikter's avatar

@Snapey I export the file directly from mysql server I wonder how it contains html and I will try and export another file

kikter's avatar

@Sinnbeck I just did and I noticed there where bunch of HTML tags in the files the actual database isn't there I think my xamp export is broken is there another way to export my database

Sinnbeck's avatar

@kikter yeah mysqldump if you have it installed. It's for the commandline

Type mysqldump in your commandline and see if it exists

Sinnbeck's avatar

@kikter ok it's quite simple

mysqldump -u username -p -D databasename > mydump.sql 
kikter's avatar

@Sinnbeck thanks that worked , I have successfully imported the database please kindly look at the website https://tribe.ng the CSS is not rendering and the front end is blank

Sinnbeck's avatar

@kikter check the source. Maybe you hard-coded the urls or the url is wrong in your env file

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Seems its working now. If the issue is solved, you can set the thread as solved by marking a best answer

kikter's avatar

@Sinnbeck was fixing some issues in the public folder, thanks for the help I so much appreciate

Please or to participate in this conversation.