I made some changes in postgresql.conf file like modifying search_path and changing port. But these changes were not being reflected. They were written in the file but were not being implemented. I used vim for editing the file.
I did those changes separately using terminal commands and they worked but can anyone tell me the reason why modifying postgres.conf was not working?
This happens sometimes because that changes was not stored/saved properly. So once you are done with the changes, save them and then run to make sure you are working on the correct file.
select name, context, setting, source, sourcefile from pg_settings where name in ('search_path', 'port');
Just don't forget to restart the server after changes in pg conf.
bin/pg_ctl -D {data-dir} restart
Related
I'm trying to pre-configure some connections for my users. The documentation clearly says that it is possible:
DBeaver can load multiple connection files. Any files in project folder matching .dbeaver/data-sources*.json pattern will be loaded on startup. So you can create a file, say, .dbeaver/data-sources-2.json in the project folder and DBeaver will see it.
But when I copy a file name data-sources-padrao.json to the path %USERPROFILE%\AppData\Roaming\DBeaverData\workspace6\General\.dbeaver\ before starting DBeaver for the first time, no connection is displayed and the file is renamed to data-sources-padrao.json.bak. If I copy it after starting DBeaver for the first time, the file is ignored.
How do I pre-configure a bunch of connections in DBeaver?
If the user already has a working installation, I'd like to add new connections without disturbing the old ones. If it is a fresh install, the user would open DBeaver and it would show all the connections already configured.
Ops, silly me. My data-sources-padrao.json wasn't well formed and was being ignored.
Fixed the '{' and '}' and everything is working fine. I'll leave the question here, maybe will be useful for someone.
DBeaver really considers every file named data-sources*.json in the conf dir as a connection file and will display all connections inside.
Using Windows 10 and PostgreSQL 9.3.
I have a batch file that executes a series of pg_dump commands to back up selected tables in a database, and a related file that uses psql to restore them into an empty database. For every call to pg_dump or psql, I have to enter a password. On customer's machines (usually some version of Windows Server), I have a pgpass.conf file to specify the password, and I don't have to enter it every time.
My pgpass.conf file contains localhost:5432:*:someuser:somepassword. I have tried putting it in %APPDATA%/postresql and putting it into a folder named c:\misc and creating an environment variable named PGPASSFILE containing c:\misc\pgpass.conf. I restarted the PostgreSQL service after I changed each one.
What am I missing?
I am afraid this is sort of a non-answer.
I figured I should try with a supported version of PostgreSQL, so I installed 9.6. I assigned it port 5435. I added a corresponding line to the file pointed to by my PGPASSFILE environment variable. It worked. I tried targeting my 9.3 database. It still worked. I removed the line for port 5435. It still worked. I copied the pgpass.conf file into the default %appdata%/postgresql folder, deleted the PGPASSFILE and it still worked!
So, I have no idea what was broken, nor do I have any idea what fixed it, but it's fixed.
I use CentOS7 as my system
I tried to change the data direction on MariaDB 10.1.43
I follow the process on internet and all show to change the datadir=/var/lib/mysql/ in my.cnf
but the problem is there is no my.cnf file in my computer
only a my.cnf.d folder with a server.cnf file in it
I type datadir=/newpath/ in this server.cnf
but it didn't work, the datadir that mariaDB shows is still /var/lib/mysql/
what should I do for now? how can I find this my.cnf file?
I realize this is an old question. But wanted to add an answer that worked for me on a legacy machine running MariaDB 10.1.43 and CentOS 6.
Within the /etc/my.cnf file add this under [client-server] to look like this:
[client-server]
port=3306
socket=/home/mysql/mysql.sock
Then, within the /etc/my.cnf.d folder in the server.cnf file add this under [mysqld] to look like this:
[mysqld]
datadir=/home/mysql
socket=/home/mysql/mysql.sock
I moved the data to the /home directory, which is a newly mounted volume with additional space for this machine.
The next part of my answer is out of scope for this question. But the instructions here worked like a charm for moving your MySQL/MariaDB data directory. Semi-pro tip: Be sure to follow the RedHat/CentOS step to add the security context.
NOTHING I do will get json-server to acknowledge changes to the db.json file. After reading https://github.com/typicode/json-server/issues/177. I have tried clearing the cache and closed all browser connections etc. (which is a pain enough in a workflow...) but still the data and schema persists in its last used state.
REST calls change the data, and the changes can be seen, that is working fine. But I need to change the schema...
How do I get json-server to restart using what is in the db.json file??
In case it helps anyone else. I started json-server from the wrong folder, so it created and loaded a default db.json. I did not catch the warning
Oops, db.json doesn't seem to exist
Creating db.json with some default data
on the very first startup. So I was altering the "wrong" file!!! Just a note in case anyone else gets caught out.
Steps:
Navigate to the path where json server is installed (json-server-master folder).
Rename the db.json as db.json_bkp
Restart the json server from command prompt
json-server --watch db.json
The db will be reset to the default values.
I've faced the similar issue.
Please check the db.json file that json-server is accessing and change it accordingly.
In my case, I was changing a different file than the correct one.
Please check for db.json file in the directory where you first installed/run the json-server. Change it according to your requirement.
Restart json-server so that changes will effect.
Go to the folder where your db.json file resides. then run the command json-server --watch db.json
I went through the same issue. I visited the the db directory (where the db.json file is situated).
Run json-server --watch db.json at the command prompt, while you are at the db directory.
I have Postgresql 9.5 installed on Ubuntu and need to use dblink. However I am using port 5433 (set in postgresql.conf) but dblink always defaults to port 5432. I know you can specify the port in the dblink parameters, but this is massive redundancy when I want to use the default port of my instance.
There is a way of telling dblink to use a specific port by default. I know this because I have successfully changed it in the past - but can't for the life of me remember how I did it. I have tried setting the PGPORT environment variable and rebooting. I have tried recreating the extension. I have tried reinstalling postgresql-contrib. None of this has made a difference. I have a feeling that there is some obscure file I edited but can't remember what, where or how.
Any suggestions of how to change the default connection parameters for dblink?
Got it!
It IS done by changing the environment variable, but this is not an environment variable in the sense that a Windows user would understand it (so changing /etc/environment does not work and neither does any other normal nix-style setting of global environment variables).
To change the default connection parameters for dblink you need to add PGPORT=5433 (in my case) to /etc/postgresql/9.5/main/environment. The annoying thing with Ubuntu install of Postgres is that I have at least three versions of all these sorts of files (including pg_HBA.conf and so on). The ones in /etc/... are mostly not read apart from in this case. It's the ones in my data directory (which for space reasons is in a non-default location). So, for anybody else having the same issue check /etc, /var, /your-data-directory.