SQLSTATE[HY000] [2002] Connection refused Don't know what to do - laravel-9

I'm using a MacbookPro M1. I am trying to run php artisan migrate, but it keeps giving me this error message.
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from
information_schema.tables where table_schema = library-app and
table_name = migrations and table_type = 'BASE TABLE')
Here's my .env file
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=library-app
DB_USERNAME=root
DB_PASSWORD=password123
I tried looking everywhere on the Internet but to no avail.
I need assistance since I have no more options.
Update:
I tried changing DB_HOST=127.0.0.1 to localhost and it didn't do anything.

Related

An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused error

i have this error from laravel how to fix this?
An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused: SET SESSION sort_buffer_size=2097144; SET NAMES 'utf8mb4'; SET SESSION sql_mode='ANSI'
i try the connection with sql and .env file but did not working. i hope so that another developer knows: how to fix this with another solution?

Illuminate\Database\QueryException SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it

enter image description here
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] No connection could be made because the target
machine actively refused it (SQL: select * from
information_schema.tables where table_schema = mocadata and table_name
= migrations and ta ble_type = 'BASE TABLE')
I think your MYSQL and APACHE Services is OFF turn it on in XAMPP Control and then try agin

Airflow Adaptive Server connection failed

I want to connect my Airflow and Microsoft SQL Server. I configured my connection under 'connections' bar in 'Admin' box as mentioned in the following link:
http://airflow.apache.org/howto/manage-connections.html
But when I run my Dag task that is related to SQL server immedatly fails by following error:
[2019-03-28 16:16:07,439] {models.py:1788} ERROR - (18456, "Login failed for user 'XXXX'.DB-Lib error message 20018, severity 14:\nGeneral SQL Server error: Check messages from the SQL Server\nDB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (***.***.***.28:1433)\n")
My code from DAG for Micrososft Sql Connection is following:
sql_command = """
select * from [sys].[tables]
"""
t3 = MsSqlOperator( task_id = 'run_test_proc',
mssql_conn_id = 'FIConnection',
sql = sql_command,
dag = dag)
I verified ip address and port number kind of configuration things by establishing connection through pymssql library from my local computer. Test code is following:
pymssql.connect(server="***.***.***.28:1433",
user="XXXX",
password="XXXXXX"
) as conn:
df = pd.read_sql("SELECT * FROM [sys].[tables]", conn)
print(df)
Could you please share if you have experienced this issue?
By the way I am using VirtualBox in Ubuntu 16.04 LTS
I had the same problem because freetds-dev was missing on linux:
apt-get install freetds-dev

How to run with t3 service in WebLogic in order to work with WLST

When started my WLST (Weblogic Scripting Tool) after setting JAVA_HOME, I am able to get into WLST, but as part my startup work I tried connect() command which in turn needs t3 protocol binding for the weblogic server which I try with WLST.
C:\bea\bea_12.1.2\wlserver\common\bin>wlst
Java HotSpot(TM) Client VM warning: ignoring option UseSpinning; support was rem
oved in 7.0_40
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
wls:/offline> connect()
Please enter your username :system
Please enter your password :
Please enter your server URL [t3://localhost:7001] :
Connecting to t3://localhost:7001 with userid system ...
Traceback (innermost last):
File "<console>", line 1, in ?
File "<iostream>", line 19, in connect
File "<iostream>", line 520, in raiseWLSTException
WLSTException: Error occurred while performing connect : Error getting the initi
al context. There is no server running at t3://localhost:7001
Use dumpStack() to view the full stacktrace :
wls:/offline> connect()
Please enter your username :system
Please enter your password :
Please enter your server URL [t3://localhost:7001] :
How I can run t3 service for my weblogic instance.

Network error on powershell SQL job step

This is partially my code and partially from others help here on stack overflow.
$excelFile = "C:\ExcelTest\Test.csv"
$functionDirectory = "C:\foldername"
$csv = Import-csv $excelFile -Header FileName
Import-Module sqlps
foreach ($line in $csv)
{
if(test-path -path ($functionDirectory + "\" + $line.FileName))
{
invoke-sqlcmd -inputfile "C:\foldername\filename.sql" -serverinstance "servername\instancename" -database "databasename"
}
}
I had to remove the specific serverinstance / servername for privacy but I've checked both of those several times and I don't think that is where the issue is. I keep getting the error
A network related or instance specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections.
I have double checked server / instance name which I got from the server by running
select ##servername + '\' + ##SERVICENAME
nd the database name obviously was easy to get. I have double checked that the server is set up for remote connection (even though this is a database that is local on my laptop and not a remote server currently).
I'm kinda at a loss for what else to check for.
I had read you should look at firewall settings but I don't think those should make a difference when its a local server on my machine.
I'm still somewhat new with SQL and powershell so I apologize for any blatant syntax or formatting errors (please point out so I can correct them). Any help would be appreciated.
Turns out I needed to remove the instance name and just use the server name.