Default Search_Path Variable Stuck After Installing Postgis with Homebrew on Mac - macos

After installing postgresql and postgis on my mac ...
brew install postgres
brew install postgis
...I have a search_path which is stuck on being just set to "postgis". The value in the postgresql.conf file is ignored or overwritten, it doesn't even mention postgis by default. Also if I run commands such as ...
ALTER USER ken SET search_path TO postgis,schema1,schema2;
ALTER DATABASE coneddb SET search_path TO postgis,shema1,schema2;
...then the path is still set to just "postgis" upon starting a new connection. What am I missing that is overriding my search_path and won't let me override it with user or database specific settings?

Uggggh. When everything else failed I tried a reboot of the machine. Bingo. No idea why a reboot would have been required here but that seems to have done the trick. My search_path is now what it is in the postgresql.conf file. And yes, I had stopped and started the service to reload the conf file. In fact, I had even made sure that changes to the conf file were being recognized by changing the port number and proving that when I brought postgresql back up it was listening on the specified port and not on the original port. So, really no idea what was going on here.

Related

Why won't Apache Server start in MAMP?

I'm trying to view php files locally on my mac.
I'm running Yosemite.
I have MAMP installed on my computer. When I press start the MySQL server starts but Apache doesn't. An error message appears saying 'Error. Apache couldn't be started. Please check your MAMP installation'
I've gone through the internet typing stuff into terminal and changing 'envvars' to '_envvars' but nothing works.
I reinstalled OSX and that worked but when I shut down the computer the problem occurs again.
Can anyone help?
Thanks
Check if you changed the Document Root Location or Renamed it. At least this was my mistake.
MAMP > Preferences > Web Server > Document Root
I didn't get it working with port 8000 or the default 8888, but did get it working with port 80 per the suggestion here:
http://forums.macrumors.com/showthread.php?t=1744944
That didn't work after all, but it didn't error out. However I manually ran the following at the command line (because log file was empty):
sudo /Applications/MAMP/Library/bin/apachectl start
Only to find that after upgrading I was missing the mod_example.so
httpd: Syntax error on line 83 of /Applications/MAMP/conf/apache/httpd.conf: Cannot load /Applications/MAMP/Library/modules/mod_example.so into server: dlopen(/Applications/MAMP/Library/modules/mod_example.so, 10): image not found
Copied it from my old install and I was good to go.
If you try to start the server from the terminal, likely that will tell you what is wrong e.g.
sudo /Applications/MAMP/bin/startApache.sh
Password:
(48) Address already in use: make_sock: could not bind to address [::]:8888
(48) Address already in use: make_sock: could not bind to address 0.0.0.0:8888
no listening sockets available, shutting down
Unable to open logs
What you can do in this case, I was inadvertently running a Blockstack browser out of 8888, so changing MAMP to 8887 allowed it to start. [Your mistake might be different.]
Had the same problem, nothing in the logs. After trying the_dillio's suggestion:
sudo /Applications/MAMP/Library/bin/apachectl start
I got an error that pointed back to my vhosts file. It turns out I had an extra /VirtualHost tag. Removed it and it started working again.
i've solved this issue using this command in the terminal :
sudo apachectl stop
I think I've found the solution.
It was the wrong port. I altered the .conf file in the Apache folder. I changed all instances of port 8888 to 8000. When I run MAMP now it all seems to work fine.
Thanks for your help
Also be aware that if you by any chance deleted the folder that was set as Document Root the last time you were using MAMP, you will get this error. Simply open MAMP again, change Document Root to a location that does exist and start the servers.
I received the same error but interestingly it was caused simply because I renamed the root folder and didn't realize it. Sounds like you have a different issue but for anyone else who gets this error message, make sure you haven't renamed the root!
Absolutely bizarre behavior for MAMP PRO (paid license too btw...)
In my case I had to change the location of the log file in order to get it to work...
Click on Mysql icon then the little folder to the right of the path and try changing it to something else.
For MAMP :
You can open the terminal and write:
ps aux | grep mysql
lsof -i
killall -9 mysqld
I hope is good for you!
Bye
I had this experience when upgrading to V4. It tried to used the files from my previous installation and it just never worked. The workaround was to RENAME the original MAMP installation to something different than "MAMP", install brand new version and then copy files you may need like VHOST configs and DATABASES. After all this it worked just fine.
My Apache server problem arose after I enabled SSL. So if this is your case, check your https-ssl.conf file (Applications -> Mamp -> conf -> apache -> extra). The Document Root under the Virtual Host settings had a different file path for htdocs than where it was actually located (easily overlooked). I changed this to "/Applications/MAMP/htdocs" and problem solved. Perhaps also check Document Root in your https.conf file (Applications -> Mamp -> conf -> apache) to see if it has the correct file path to htdocs too.
These are the steps I used to solve this issue.
Checking vcredist that are required and installing them. to check which are the missing vcredist I used a tool called "check_vcredist" from wamp.
I also installed latest Microsoft Visual C++ Redistributable x64.
Doing this steps solved my issue of Apache server not running

Yosemite - MAMP - Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)

I have problem when I try to connect to MySQL MAMP :
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)
I'm doing research but I have not found a solution to my problem, I try to link mysql.sock like this :
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
But, the file /tmp/mysql.sock doesn't exist.
Do you have any ideas ? The problem is blocking me for 2 days, I searched for this time but nothing good for me.
Thanks in advance,
I had the same problem after upgrading MySQL on MAMP from 5.5 to 5.6 version.
After long research I founded this decision https://drupal.stackexchange.com/questions/32402/drush-and-mysql-database-with-mamp-connection-problem
In my case there was no socket file at that location /Applications/MAMP/tmp/mysql/mysql.sock.
The easy solution is to create a symlink:
cd /tmp
ln -s /Applications/MAMP/tmp/mysql/mysql.sock ./mysql.sock
The effect of which is to route all calls for /tmp/mysql.sock to the appropriate MAMP specific path.
simply remove two files ib_logfile0 and ib_logfile1 from /Applications/MAMP/db/mysql56
In some cases /Applications/MAMP/tmp/mysql/mysql.sock.lock may create the problem. remove .lock and it will work (OSX)
I had the same problem. I solved it following these steps:
I stopped and restarted MySQL via System Preferences -> MySQL (see also https://stackoverflow.com/a/26523977/204807)
I entered sudo mysql_upgrade in a terminal window, and pressed enter
After the update process I was able to connect with my MySQL.
Rename .sock file of mysql and restart your MySQL server.
/Applications/MAMP/tmp/mysql/mysql.sock to /Applications/MAMP/tmp/mysql/mysql_old.sock
Also check to make sure MySql is running. You can get this error if you try to use MySql from the command line when MAMP/MySql is not running.
In case this helps anyone, I got past this roadblock by:
Stopping all other versions of MySQL (I forgot that I had Oracle MySQL starting on system launch and I was attempting to connect via that installation.) and removing them anyway to let MAMP handle it.
Use sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
Ensure MAMP is running.
Running /Applications/MAMP/Library/bin/mysql.
1) mysql.server stop
2) /Applications/MAMP/bin/startMysql.sh &&
now on MAMP go to
Tools => Upgrade MySQL databases

Mongodb: Failed to connect to 127.0.0.1:27017, reason: errno:10061

Here is my mongod.cfg file:
bind_ip = 127.0.0.1
dbpath = C:\mongodb\data\db
logpath = C:\mongodb\log\mongo-server.log
verbose=v
Here is my mongod service command:
mongod -f c:\mongodb\mongod.cfg --install
I have installed MongoDB about a week ago and it all worked fine, however today when I ran mongo command I got the following error:
Failed to connect to 127.0.0.1:27017,
reason: errno:10061 No connection could be made because the target machine actively refused it
How can I fix that? I use Windows 8.1
Solution:
I forgot to start mongodb service with this command:
net start mongodb
Improved solution:
1) Change directory to root drive C:\, and type the command below into an admin cmd prompt window,
C:\mongodb\bin\mongod.exe --config c:\mongodb\mongod.cfg --install
2) Then type net start MongoDB after which you should see the following message:
"The Mongo DB service was started successfully"
3) Then go to the control panel Start>Administrative Tools>Services, scroll down to MongoDB in the list of services and change start up type to automatic, if you so desire. Press OK.
4) Finally type C:\mongodb\bin\mongo.exe and you should be connected to the Mongo test DB.
Reference: https://www.youtube.com/watch?v=-mik4dPArCU
This is how I solved it, You can follow step by step here:
MongoDB Steps:
Download the latest 64-bit MSI version of MongoDB for Windows.
Run the installer (.msi file)
Add it to your PATH of environment variables. it Should be from:
C:\Program Files\MongoDB\Server\3.0\bin
now Create a “\data\db” folder in C:/ which is used by mongodb to store all data. You should have this folder:
C:\data\db
Note: This is the default directory location expected by mongoDB,
don’t create anywhere else
.
Finally, open command prompt and type:
>> mongod
You should see it asking for permissions (allow it) and then listen to a port.
After that is done, open another command prompt, leaving the previous one running the server.
Type in the new command prompt
>> mongo
You should see it display the version and connect to a test database.
This proves successful install!=)
Reference link
When you typed in the mongod command, did you also give it a path? This is usually the issue. You don't have to bother with the conf file. simply type
mongod --dbpath="put your path to where you want it to save the working area for your database here!! without these silly quotations marks I may also add!"
example: mongod --dbpath=C:/Users/kyles2/Desktop/DEV/mongodb/data
That is my path and don't forget if on windows to flip the slashes forward if you copied it from the or it won't work!
I was also faced the same issue with mongodb 2.6.
What solved my problem was I just run mongod --repair command
and then start mongod.exe
It's worked for me
just create a folder
C:\data\db
Run below commands in command prompt
C:\Program Files\MongoDB\Server\3.4\bin>mongod
Open another command prompt
C:\Program Files\MongoDB\Server\3.4\bin>mongo
mongodb 2.6.8 on windows7 32bits
you only need create a folder c:/data/db
execute mongod, and execute mongo
Point to your mongodb instalation e.g C:\Program Files\MongoDB\Serve\bin and run mongod.exe so you can open connection to 127.0.0.1:27017.
If it writes that you had not properly shut down or that mongod.lock is not empty
, only delete mongod.lock from C:\data\db\ and it will start.
The problem is that I missed out 'db' folder for the dbpath in the command:
C:\mongodb\bin> mongod --directoryperdb --dbpath C:\mongodb\data\db --logpath C:\mongodb\log\mongodb.log --logappend -rest --install
Under normal conditions, at least 3379 MB of disk space is needed. If you do not have that much space, to lower this requirement;
mongod.exe --smallfiles
This is not the only requirement. But this may be your problem.
What solved my issue was creating a file startmongo.conf that sets the bind_ip to 127.0.0.1 . After that, I just created a *.bat to start the mongo using something like:
mongod --config c:\mongodb\bin\startmongo.conf
When This Error is Coming it is lack of the following
1)Setting the path to mongo db
go to "C" Drive and the installation of Mongo db directory and then go to bin folder in the mongo and copy the path of it
c:/mongodb/server/3.2/bin/ and create a new environmental variable in system properties then name is path and value="c:/mongodb/server/3.2/bin/" here my version is 3.2
2)create a data directory for the data in C Drive
c:/Data/twitter
3)start the server with **
c:/> mongod
check your port config if there is any error as the local port may be assigned to any other
4)start your Mongo database with
Mongo
then your mongo db will start
then in your mongo database
create a database
use DATABASE_NAME
for example:
use twitterdata
switched to db twitterdata
to check your current database
db
twitterdata
to get total databases
show dbs
I started mongod in cmd,It threw error like C:\data\db\ not found.
Created folder then typed mongod
opened another cmd typed mongo it worked.
Here are the steps to solve this issue:
Just go to your MongoDB bin folder and run the mongod.exe file.
Navigate to your mongodb bin folder via Command prompt and start mongo by typing "mongo"
Change file permission to 755 for the file:
/var/lib/mongodb/mongod.lock
first you run the command mongod and check weather the port 27017 has started or not if yes then hit the command mongo....and database will start.
The Port is not open. Thats why the machine refuses communication
Try this, it worked for me.
mongod --storageEngine=mmpav1

Setting Windows PATH for Postgres tools

I cannot access PostgreSQL through the command line in Windows. Although I am able to create and update the databases, access them through PGAdminIII, and push to Heroku, I am unable to access them directly through my command line using the psql command.
When I try to create a database by using the command
$ createdb mydb
as explained in the PG documentation, I get the message
createdb: command not found
The documentation suggests that in this case, "PostgreSQL was not installed properly. Try calling the command with an absolute path instead." Sure enough, I am able to create a database by entering the direct path to the file:
$ c:/postgreSQL/9.1/bin/createdb mydb
Does this mean that the path can be reconfigured to connect correctly? Or do I need to reinstall? I've reinstalled several times, and have not been able to set the correct path. I currently have both the /bin and /lib paths addedto my system and user(:Umezo) paths, but still no access from the command line.
User variables for umezo
variable name: Path
variable value: C:\PostgreSQL\9.1\bin; C:\PostgreSQL\9.1\lib
System variables
variable name: Path
variable value: C:\PostgreSQL\9.1\bin; C:\PostgreSQL\9.1\lib
Any information or feedback regarding how I can fix my installment would be appreciated.
My info is as below:
I mostly followed these sources here and here. I installed a 32 bit version of 9.1 because some sources suggested issues with 64 bit.
PG download version: Installer Version 9.1 Win x86-32
Operating System: Windows 7 (64 bit)
pg_hba.conf
#TYPE DATABASE USER CIER-ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
postgresql.conf
# - Connection Settings -
listen_addresses = '*'
port = 5432
max_connections = 100
pg_ident.conf
# *Everything is commented out*
Login Role Umezo #from properties window in PGAdminIII
Properties/Role name: Umezo
Properties/Can login: "check"
Role privileges: all categories "check"
configuring postreSQL PATH variable on Windows 7
I encountered this issue too. I'm using Git Bash, hence the Unix-style $ prompt on Windows.
$ rails db
Couldn't find database client: psql, psql.exe. Check your $PATH and try again.
Here's what I did:
In Windows 7, navigate to:
Control Panel
All Control Panel Items
System
Advanced System Settings
Environment Variables
from the System Variables box select "PATH"
Edit...
Then append this string to the existing PATH Variable Value:
;C:\Program Files\PostgreSQL\9.2\bin
and click "OK" three times to exit the menus.
Now, close the console and restart it.
Navigate back to the directory of your Rails app. In my case, this is accomplished with:
$ cd rails_projects/sample_app
Then, try again:
$ rails db
sources:
How do I put PostgreSQL /bin directory on my path in Windows?
http://railscasts.com/episodes/342-migrating-to-postgresql?view=asciicast
Settings Windows Path For Postgresql
open my Computer ==>
right click inside my computer and select properties ==>
Click on Advanced System Settings ==>
Environment Variables ==>
from the System Variables box select "PATH" ==>
Edit... ==>
then add this at the end of whatever you find their
;C:\PostgreSQL\9.2\bin; C:\PostgreSQL\9.2\lib
after that continue to click OK
open cmd/command prompt.... open psql in command prompt with this
psql -U username database
eg. i have a database name FRIENDS and a user MEE.. it will be
psql -U MEE FRIENDS
you will be then prompted to give the password of the user in question.
Thanks
Set path For PostgreSQL in Windows:
Searching for env will show Edit environment variables for your account
Select Environment Variables
From the System Variables box select PATH
Click New (to add new path)
Change the PATH variable to include the bin directory of your PostgreSQL installation.
then add new path their....[for example]
C:\Program Files\PostgreSQL\12\bin
After that click OK
Open CMD/Command Prompt. Type this to open psql
psql -U username database_name
For Example psql -U postgres test
Now, you will be prompted to give Password for the User. (It will be hidden as a security measure).
Then you are good to go.
All you need to do is to change the PATH variable to include the bin directory of your PostgreSQL installation.
An explanation on how to change environment variables is here:
http://support.microsoft.com/kb/310519
http://www.computerhope.com/issues/ch000549.htm
To verify that the path is set correctly, you can use:
echo %PATH%
on the commandline.
On Postgres 9.6(PgAdmin 4) , this can be set up in Preferences->Paths->Binary paths:
- set PostgreSQL Binary Path variable to "C:\Program Files\PostgreSQL\9.6\bin" or where you have installed
In order to connect my git bash to the postgreSQL, I had to add at least 4 environment variables to the windows. Git, Node.js, System 32 and postgreSQL. This is what I set as the value for the Path variable: C:\Windows\System32;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Program Files\PostgreSQL\12\bin; and It works perfectly.
Set Environment in Windows
Our createdbfile exists in this marked folder .so copy this folder path and paste inside environment variables setting under system variables.
start -> Environment Variables
select Environment variable
Create a new environment variable like this
Add environment variable postgres as %postgres% in the path variable
Now check by taking a new command prompt and typing conda (close already opened terminal or cmd)
Now live
Incase any one still wondering how to add environment variables then please use this link to add variables.
Link: https://sqlbackupandftp.com/blog/setting-windows-path-for-postgres-tools
I am using Windows 8 and the above solutions did not work out for me. I downgraded Postgres from 9.4 to 9.3. Man,it worked :)

Installing Membase from source

I am trying to build and install membase from source tarball. The steps I followed are:
Un-archive the tar membase-server_src-1.7.1.1.tar.gz
Issue make (from within the untarred folder)
Once done, I enter into directory install/bin and invoke the script membase-server.
This starts up the server with a message:
The maximum number of open files for the membase user is set too low.
It must be at least 10240. Normally this can be increased by adding
the following lines to /etc/security/limits.conf:
Tried updating limits.conf as suggested, but no luck it continues to pop up the same message and continues booting
Given that the server is started I tried accessing memcached over port 11211, but I get a connection refused message. Then figured out (netstat) that memcached is listening to 11210 and tried telneting to port 11210, unfortunately the connection is closed as soon as I issue the following commands
stats
set myvar 0 0 5
Note: I am not getting any output from the commands above {Yes: stats did not show anything but still I issued set.}
Could somebody help me build and install membase from source? Also why is memcached listening to 11210 instead of 11211?
It would be great if somebody could also give me a step-by-step guide which I can follow to build from source from Git repository (I have not used autoconf earlier).
P.S: I have tried installing from binaries (debian package) on the same machines and I am able to successfully install and telnet. Hence not sure why is build from source not working.
You can increase the number of file descriptors on your machine by using the ulimit command. Try doing (you might need to use sudo as well):
ulimit -n 10240
I personally have this set in my .bash_rc so that whenever I start my terminal it is always set for me.
Also, memcached listens on port 11210 by default for Membase. This is done because Moxi, the memcached proxy server, listens on port 11211. I'm also pretty sure that the memcached version used for Membase only listens for the binary protocol so you won't be able to successfully telnet to 11210 and have commands work correctly. Telneting to 11211 (moxi) should work though.

Resources