373
votes
Accepted
connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host
Add or edit the following line in your postgresql.conf :
listen_addresses = '*'
Add the following line as the first line of pg_hba.conf. It allows access to all databases for all users with an ...
33
votes
connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host
This solution works for IPv4 / IPv6:
Edit pga_hba.conf File
Open up the pga_hba.conf file in your favourite editor:
[root@localhost ~]# nano /var/lib/pgsql/data/pg_hba.conf
Append To pga_hba.conf ...
25
votes
connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host
The way I solved this was:
Added the line as below in pg_hba.conf:
hostnossl all all 0.0.0.0/0 trust
and this was modified in postgresql.conf, as shown:
...
13
votes
connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host
Fresh Postgres 9.5 install, Ubuntu.
The key was the local connection type, since psql uses domain socket connection.
pg_hba.conf
# TYPE DATABASE USER CIDR-ADDRESS METHOD
local all all md5
host ...
11
votes
connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host
Instructions for Debian users.
Login as posgres user:
$ sudo su - postgres
Get the location of pg_hba.conf by quering the database:
$ psql -c "SHOW hba_file;"
hba_file ...
11
votes
Accepted
How to create recurrent weekdays as columns in a pivot?
The most complex part of this is just building the calendar in that format. Pivoting and surrounding it with HTML is pretty easy. First, let's start with this, your employee table with leave dates. ...
10
votes
connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host
Add the following line in the bottom of pg_hba.conf:
hostnossl all all 0.0.0.0/0 md5
Add/modify the line in postgresql.conf:
listen_addresses = '*'
MAKE SURE THAT the ...
9
votes
What does it mean that PostgreSQL "offers" PHP?
Language extensions allow you to write user-defined functions in additional programming languages. Most people are aware of SQL and PL/pgSQL, but Postgres also ships with extensions for Perl, Python, ...
7
votes
Accepted
Percona MySQL 5.5 Unique key is duplicated
This looks like you might have hit a bug logged against Percona Server 5.5:
Concurrent duplicate inserts can violate a unique key constraint in InnoDB tables.
There is no fix and no reproducible test ...
6
votes
connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host
This below worked for me: (pg_hba.conf)
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all ...
6
votes
Combining 2 SELECT queries and printing the results in PostgreSQL
The primary solution is to add parentheses:
( -- parentheses required!
SELECT dt1.name AS name1, dt1.time AS time1
, dt2.name AS name2, dt2.time AS time2
FROM departure_times dt1
JOIN ...
6
votes
Timeout error after SQL Server upgrade from 2008R2 to SQL Server 2014
The Cardinality Estimation logic was updated for SQL Server 2014 and could potentially be a reason. You would have to test the same queries with the old cardinality estimator and compare performance ...
6
votes
Accepted
Disadvantage of Changing database schema - Insert or delete new columns/tables in middle
The foundation of your system is your database. If you change your database schema then you also have to change your code. That means that keeping a stable data model helps to reduce the amount of ...
6
votes
Accepted
What happens if a delete query times out SQL Server for php?
When a timeout occurs, the client API sends an attention signal to SQL Server to cancel the executing query. Upon receipt, SQL Server cancels the query and rolls back the transaction. Data ...
6
votes
Accepted
How to update "sorting_order" column of other rows when changing one?
Add new category :
$t_cat = 'jeans';//new category to insert
$so_to_set = 2;// so for new category
First update all so greater than or equal to $so_to_set
$query = "update categaries ...
6
votes
Accepted
Should I use VARCHAR or DATETIME?
You should always store dates using the DATE type. It should use less storage and will generally be faster when searching than if you stored the same date as a VARCHAR.
Additionally, if you stored ...
6
votes
Accepted
Entering Exact Values into a Table Using SQL
Just do not use string interpolation or concatenation to get values into SQL queries in PHP. That's error prone and might make your program vulnerable to SQL injection attacks.
Use parameterized ...
5
votes
Inserting data into multiple tables
Use mysqli or PDO libraries for PHP, do not use mysql, as it is deprecated
Use prepared statements: they are cleaner, less prone to SQL injection and, in some cases, faster to execute
Use exceptions ...
5
votes
connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host
I had the same error when I tried to connect to a local database using an SSH tunnel. I solved it by changing the host name from localhost to 127.0.0.1.
5
votes
Accepted
How do I perform a query on a dynamic list of tables?
All of this could have been accomplished with the INFORMATION_SCHEMA database
The table names are in the INFORMATION_SCHEMA
SELECT table_name FROM information_schema.tables
WHERE table_schema='...
5
votes
Accepted
Optimization of complicated sums and counts in related tables
Your question shows you are thinking in a procedural way, however you need to think in a "set-based" way.
The following query may help you understand this better:
SELECT p.customer_id
, c.name
...
5
votes
Searching a text with space in mySql match against Query
FULLTEXT needs space to be space, not a "letter". That is, you cannot have spaces in a "word".
I would write application code to ignore 'short' words (such as 'g') and end up with
WHERE MATCH(...
5
votes
Cassandra "Operation timed out - received only 0 responses." during write
You will need to increase commitlog_segment_size_in_mb to a higher value. Try 64MB instead.
It increases the size of the commit record segment. This property determines the maximum mutation size (...
5
votes
Accepted
Timeout error after SQL Server upgrade from 2008R2 to SQL Server 2014
I finally find out the problem. After days of straggling I checked the SQL Server report and noticed that there were very large occasions of autogrowth on temp db database. The cause of the problem ...
5
votes
Accepted
How to select records where NOW is between two dates in fields?
You can use the NOW() function in mysql. Note, this assumes that termDate is the later date:
Select content, image, imageHeight, imageWidth, link, linkDescription
From news
Where appearanceDate &...
5
votes
Accepted
Mysql select rows with 7 continuous dates
MySQL 8
MySQL 8 provides window functions...
SELECT item_id
FROM (
SELECT
item_id,
date,
count(coalesce(diff, 1)=1 OR null) OVER (PARTITION BY item_id ORDER BY date) seq
FROM (
...
5
votes
Order by numbers followed by alphabet and then null values
select
*
from
t
order by
case
when col regexp '^[0-9]' then 1
when col regexp '^[a-zA-Z]' then 2
when col = '' or col is null then 3
end
, col * 1 /*this converts to number, so that 100 is not sorted ...
5
votes
Why is ON DUPLICATE KEY not working as expected?
Any idea why this query doesn't work with table B? Do you have to insert/update every table column when running the query?
Yes, UserName is a NOT NULL column and doesn't have a DEFAULT value. ...
5
votes
Accepted
MySQL Query Failed: Expression #6 of SELECT list is not in GROUP BY clause and contains non aggregated column fixed bug reappear every restart
That's not a bug. That's 'move to standard'.
Do not fix this problem by change server's SQL Mode. Fix it by altering the queries which uses partial GROUP BY expressions.
Details can be read in ...
5
votes
Accepted
MySQL: Why not create an index on every column? What is the cost of indexing a column?
An index literally stores a copy of the data, sorted on the fields covered by that index (and automatically includes the clustered index key), generally in a data structure called a B-Tree.
Creating ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
php × 661mysql × 546
phpmyadmin × 57
database-design × 50
sql-server × 26
postgresql × 25
performance × 25
mysqli × 24
mariadb × 19
join × 17
mysql-5.5 × 16
innodb × 15
query-performance × 14
optimization × 14
mongodb × 13
mysql-5.6 × 11
linux × 8
array × 8
query × 7
select × 7
ubuntu × 7
replication × 6
permissions × 6
foreign-key × 6
insert × 6