Hot answers tagged

71

If you can connect to the database with superuser access, then SHOW data_directory; is the shortest way. If the server is not running and you forgot where the data directory was, then you really have to guess yourself. An operating system specific convention or the shell history might provide hints.


25

I found that I had an extremely similar problem, namely that postgres was opening a socket in /var/pgsql_socket_alt where none of my software expects to look, but the solution to my problem was not only a problem with my $PATH. I had to create the directory /var/pgsql_socket, chown it to myself, and set unix_socket_directory in postgresql.conf (located in /...


24

Locate the psql binary. (In a terminal, run locate psql | grep /bin, and make note of the path. (In my case, it's /opt/local/lib/postgresql90/bin/, as it was installed using MacPorts.) Then, edit the .bash_profile file in your home folder (e.g. mate -w ~/.bash_profile assuming you've textmate), and add the needed line so it's in your path, e.g.: export ...


21

You can also query for it select setting from pg_settings where name = 'data_directory';


14

One of the silent killers of MySQL Connections is the MySQL Packet. Even the I/O Thread of MySQL Replication can be victimized by this. According to the MySQL Documentation You can also get these errors if you send a query to the server that is incorrect or too large. If mysqld receives a packet that is too large or out of order, it assumes that something ...


12

No, SQL Server will not run on OS X (it can run on a Mac, if you use Boot Camp and boot natively to Windows). Otherwise you will need to install virtualization software of some sort, where you install Windows in a VM, and install SQL Server there - I use Parallels Desktop, but there is also VMWare Fusion and Oracle VirtualBox (I haven't tested the latter ...


10

pg_config shows a lot of information including the data directory: CONFIGURE = '--disable-debug' '--prefix=/usr/local/Cellar/postgresql/9.3.2' '--datadir=/usr/local/Cellar/postgresql/9.3.2/share/postgresql' '--docdir=/usr/local/Cellar/postgresql/9.3.2/share/doc/postgresql' '--enable-thread-safety' '--with-bonjour' '--...


8

On Ubuntu\Debian, try the pg_lsclusters command. On my machine: pg_lsclusters Version Cluster Port Status Owner Data directory Log file 8.4 main 5432 online postgres /home/adam/db/main/data /home/adam/db/main/log


7

If you can't log in (eg, forgot your password) but the service is running, as MacOS X is a posix varient, you can always check ps to see if it's being passed in as an argument : On a linux box with two postgres instances running: -bash-3.2$ ps ax | grep postgres | grep -v postgres: 4698 ? S 9:59 /opt/PostgreSQL/8.4/bin/postgres -D /opt/...


6

I strongly recommend using Postgres.app from the Heroku team, which is also supported by them! It has a menubar icon and the menu has a psql item: You will also find psql included here if you want the same version of that as the server (path may vary by version): /Applications/Postgres.app/Contents/MacOS/bin If you want, you can add this path to your ...


6

The next thing to check is probably that you have a line in your postgresql.conf that looks like this: listen_addresses = '*' You will have to restart after changing that line. Otherwise your pg_hba.conf looks fine. Good luck! Getting started is a big hurdle, but once you get through it, you will probably find that compared to MySQL things are a lot ...


6

A plausible and typical explanation would be that the psql that comes with homebrew is in /usr/local/bin/psql which is different from the one that would be in your $PATH, like /usr/bin/psql (bundled with OS X). You may want to try with the full path: $ /usr/local/bin/psql -U rails -d myapp_development Also, there's something rather unusual in the ps ...


6

Create the new database, then create a tablespace on your external drive: CREATE TABLESPACE mytablespace LOCATION '/Volumes/externaldisk/pg'; Then alter the database so that the new tablespace is the default location for it: ALTER DATABASE MYDB TABLESPACE mytablespace; The other way to do this is to just move your entire Postgres data directory to the ...


6

I very strongly recommend that you do not put a tablespace on an external removable drive. If the tablespaces disappears (ie: drive unplugged) you risk severe database corruption that will be difficult to recover from. You'll likely find permissions management a challenge, too. You should generally initdb a new database cluster on the drive, then start it ...


5

You many need to take a look at the comprehensive list of all Server Variables. Some of them you can change for the duration of your session, some you may change with the SET GLOBAL command, and other options may require a restart of MySQL. Here is the list of all options. This will also show which options can be used in option files.


5

Check the wiki page, many different tools available.


5

The reason is that it is wise to run the database processes under a separate account. At least one advantage of this is that the OS processes as safer in the case of the database server being hacked. On the other side the database related files are safer from the 'normal' user accounts too - the PostgreSQL cluster (or at least its data) is relatively easy ...


5

I had this same problem too, and changing the port in /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist fixed the issue, with no side effects so far. Changing the port in my.cnf didn't work. It makes the Preference Pane say that MySQL is not running, and makes it impossible to start from the Preference Pane.


4

Try specifying -h localhost as a psql parameter, to connect via tcp/ip rather than a unix socket. Likely, your psql and postgresql have different ideas of the correct setting for unix_socket_directory. Especially seeing as you have at least two different builds of postgresql installed! You might want to make sure you're using the psql client that ...


4

http://code-remind.blogspot.com.au/2011/12/on-macbookpro-10.html NOTE: Where the author suggests using the path '/Applications/MAMP/bin/stoptMysql.sh' at the end... there's a typo. Should be '/Applications/MAMP/bin/stopMysql.sh'


4

To make it easier for future users to find a working answer: It appears that one method to fix this problem is to create a symlink from the DB2 location to the Java Home you wish to use. Since I told DB2 to use my user when I installed it (this is for a development copy), the command I used to fix this problem was: sudo ln -s /Library/Java/...


4

You should really increase max_locks_per_transaction. As specified in http://www.postgresql.org/docs/9.0/static/runtime-config-locks.html , changing this parameter may require to also change the System V shared memory. You have to increase that value also. In OS X this can be done as explained in http://www.postgresql.org/docs/9.0/static/kernel-resources....


4

If you have a mac and do not want to run a virtual machine, there are a few options. You can grab a Azure trial and setup an SQL Server instance. Azure also provides a web based query interface. You could also setup a Amazon RDS free account and create an SQL Server instance. If you need an MSSQL database client which runs on OS X (similar to SSMS) there ...


3

Sounds like DB2 doesn't know where Java is installed. See the following three links for related information. Link One Link Two Link Three I realize these are for Linux and you are on Max OSX, but Mac's OS is a variant of Unix, so the solution should be similar.


3

You seem to have no fewer than four psql binaries on your system. All other things being equal when you type psql in the terminal it will use the first one it finds (probably /usr/bin/psql -- the one that came with OS X). Make sure you're using the psql command that matches the Postgres server you're running (you can modify your PATH= in the .profile file ...


3

According to the installation guide after the installation has finished there should be shortcuts for StackBuilder, pgAdmin3 and psql in the Application folder of Postgres: You will also find additional shortcuts to run pgAdmin, the psql command line interface and to access the PostgreSQL documentation. If there are such shortcuts check where the psql'...


3

Late, but I found this helpful: http://tammersaleh.com/posts/installing-postgresql-for-rails-3-1-on-lion That was for Lion, but I was having same issues as the one in this thread after upgrading from 10.6.8 to Mountain Lion and having installed PostgreSQL via HomeBrew prior while on 10.6.8. I also had the mysterious /var/pgsql_socket_alt folder post-...


3

I'm currently developing a Mac client for PostgreSQL named PG Commander. My goal is to make the best designed PostgreSQL client for the Mac -- it's not as full featured as pgAdmin, but it's a lot easier to use.


3

Full disclosure.. I am the author of the following program. Give it a try and let me know what you think. I have tried many applications including the excel add-in from MySQL, but was not satisfied with them, so I wrote my own. The current version of my program is slow (just like the MySQL add-in), doesn't support international characters, and doesn't ...


3

The problem is indeed as @Phil hinted at. To fix it, set the permissions for the _mysql user: > cd ~ > touch mysql.log > sudo chown _mysql:wheel mysql.log Restart MySQL after that and the log file will be used.



Only top voted, non community-wiki answers of a minimum length are eligible