List:General Discussion« Previous MessageNext Message »
From:Govinda Date:January 3 2012 4:52pm
Subject:Re: why does basic MySQLdump on db table fail with "Permission denied", or else it creates a zero KB file
View as plain text  
Jan, thanks so much for taking the time with me. 
I hesitate to spend much of everyone's inbox space on this as it is getting off topic, and
I am newbie enough with all things CL that folks will tire of me before I am near ready to
complete the thread.

Like it took me a bit of time to think/research/experiment ... to even discover to the
point of responding, that:
	- (see below, intermingling text)


>>> If you're using MacOS X Server, it should be in /usr/bin, which should be in
> your default $PATH, or else you couldn't do ANYTHING, including "ls."
>> 
>> I have notes somewhere in my stuff about how to get $PATH to include where mysql
> actually lives, but once I realized what the issue was (in my OP this thread) then I was
> fine with just using a full path for now.  The convenience of a 'fixed' $PATH will be
> nice, sooner or later (when I get to it), but for now it is just as well that I let it
> beat into my head how the CL is actually working (working out the full paths)
> 
> You should fix the $PATH, as you'll need it for utilities (such as mysqldump) and
> such.

well , yes, it will be nice to no how to manipulate the $PATH ... and meanwhile using full
paths when invoking a command does work.. and forces me to at least remember that is how
any command works, right?  I mean the shell is always (AFAIK) resolving full paths.

> 
> You need to edit your shell startup file. For bash, it's ".bash_profile" in your home
> directory. Other shells will have their own startup script.

I am using tcsh.  
I found that my $PATH (apparently) lives here:
~/.profile

> My .bash_profile includes:
> 
> export
> PATH="$HOME/bin:/Developer/Tools:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/opt/local/sbin"

mine was this:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

..which I just (earlier this morning) changed to this:
export
PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/mysql/bin/mysqldump:$PATH"

> 
> Do "echo $SHELL" to see which shell you're using.

/bin/tcsh

> 
> Do "printenv" to see all your global shell variables, including $SHELL and $PATH.

Govind% printenv
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
[snip]
SHELL=/bin/tcsh
HOME=/Users/Govind
USER=Govind
LOGNAME=Govind
[snip]


PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
I don't understand why this ^^^ is different than what is shown in the '~/.profile' file

> 
>>> What does "locate mysqldump" tell you?
>> 
>> Govind% locate mysqldump
>> 
>> WARNING: The locate database (/var/db/locate.database) does not exist.
>> To create the database, run the following command:
>> 
>> sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
> 
> [message repeated after running the suggested command]
> 
> What that does is tells the system launcher to index your disks in the background, so
> it's no surprise that it would not immediately create a working database.
> 
> It should have finished by now, and you should now be able to run the locate
> command.

right, yes.  Now it works:

Govind% locate mysqldump
[snip]
/usr/local/mysql-5.5.15-osx10.6-x86_64/bin/mysqldump
/usr/local/mysql-5.5.15-osx10.6-x86_64/bin/mysqldumpslow
/usr/local/mysql-5.5.15-osx10.6-x86_64/man/man1/mysqldump.1
/usr/local/mysql-5.5.15-osx10.6-x86_64/man/man1/mysqldumpslow.1
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/include/mysqldump.inc
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/r/mysqldump-compat.result
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/r/mysqldump-max.result
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/r/mysqldump-no-binlog.result
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/r/mysqldump.result
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/r/mysqldump_restore.result
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/r/rpl_mysqldump_slave.result
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/t/mysqldump-compat.opt
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/t/mysqldump-compat.test
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/t/mysqldump-max-master.opt
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/t/mysqldump-max.test
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/t/mysqldump-no-binlog-master.opt
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/t/mysqldump-no-binlog.test
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/t/mysqldump.test
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/t/mysqldump_restore.test
/usr/local/mysql-5.5.15-osx10.6-x86_64/mysql-test/t/rpl_mysqldump_slave.test

...which strikes me as odd (again, showing how new I am to driving from the CL), because I
do NOT see any entry like this:
/usr/local/mysql/bin/mysqldump

...which I know is here (and is what I use (AFAICT), when I successfully use the full path
to call mysqldump, like so:
Govind% /usr/local/mysql/bin/mysqldump -uroot -p myDBname myTableName >
/Users/Govind/myTestDumpedTable.sql
):

Govind% pwd
/usr/local/mysql/bin
Govind% ls -al
total 251832
drwxr-xr-x  44 root  wheel      1496 Dec 29 09:57 .
drwxr-xr-x  16 root  wheel       544 Jul 13 16:23 ..
-rwxr-xr-x   1 root  wheel     14656 Jul 13 15:44 innochecksum
-rwxr-xr-x   1 root  wheel      1424 Jul 13 15:43 msql2mysql
[snip]
-rwxr-xr-x   1 root  wheel   4202416 Jul 13 15:49 mysql
-rwxr-xr-x   1 root  wheel   4220112 Jul 13 15:49 mysql_client_test
[snip]
-rwxr-xr-x   1 root  wheel   3895272 Jul 13 15:49 mysqldump
-rwxr-xr-x   1 root  wheel      7402 Jul 13 15:43 mysqldumpslow
[snip]
-rwxr-xr-x   1 root  wheel   2952616 Jul 13 15:44 resolveip


> 
>>> How about "echo $PATH"?
>> 
>> Govind% echo $PATH
>> /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
> 
> I don't have the official binary distribution in front of me, but once you get
> "locate" working, you can add the path of your MySQL binaries to the $PATH variable by
> appending it (preceded by a colon) to the $PATH declaration in your shell's startup
> script.

If I follow your directions to the letter, then I would make my ~/.profile contents this:
export
PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/mysql-5.5.15-osx10.6-x86_64/bin/mysqldump:$PATH"

..but I instead tried this:
export
PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/mysql/bin/mysqldump:$PATH"

...and then when i attempt the same mysqldump as I successfully do, but with the shortcut
path to mysqldump, like so:
Govind% mysqldump -uroot -p myDBname myTableName > /Users/Govind/myTestDumpedTable.sql

..then it still gives me:
mysqldump: Command not found.


Whatever is the thorough answer here, I assume it will allow me to also log into mysql
without using a full path (as I currently have to do)

Anyway, I would just make my ~/.profile contents this:
export
PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/mysql-5.5.15-osx10.6-x86_64/bin/mysqldump:$PATH"

..but I am hesitant to tread much further without understanding why my ~/.profile contents
is currently this:
export
PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/mysql/bin/mysqldump:$PATH"

..but I do not see that new path to mysqldump here:

Govind% echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin

...nor here:
Govind% printenv
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
[snip]

I use git commands without full path, from any directory, successfully, so I know this is
right:
Govind% echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin

..so then why is there no mention of git in  ~/.profile  ?

Again, I sincerely appreciate your time and efforts on my behalf Jan!!
And I will not feel disappointed in the least if you do not reply, as I KNOW this whole
thread is not deep into the territory of: "NOT a direct MySQL question", and "RTFM".
:-)
-Govinda
Thread
why does basic MySQLdump on db table fail with "Permission denied", or else it creates a zero KB fileGovinda29 Dec
  • Re: why does basic MySQLdump on db table fail with "Permission denied",or else it creates a zero KB fileAndy Wallace29 Dec
  • Re: why does basic MySQLdump on db table fail with "Permission denied",or else it creates a zero KB fileReindl Harald29 Dec
    • Re: why does basic MySQLdump on db table fail with "Permission denied", or else it creates a zero KB fileGovinda29 Dec
      • Re: why does basic MySQLdump on db table fail with "Permission denied",or else it creates a zero KB fileReindl Harald29 Dec
        • Re: (off topic) why PATHhsv1 Jan
          • Re: (off topic) why PATHReindl Harald1 Jan
            • Re: (off topic) why PATHClaudio Nanni1 Jan
              • Re: (off topic) why PATHReindl Harald1 Jan
              • Re: (off topic) why PATHJohan De Meersman1 Jan
                • Re: (off topic) why PATHClaudio Nanni1 Jan
                  • Re: (off topic) why PATHReindl Harald1 Jan
                    • Re: (off topic) why PATHClaudio Nanni1 Jan
                      • Re: (off topic) why PATHReindl Harald1 Jan
                • Re: (off topic) why PATHReindl Harald1 Jan
Re: why does basic MySQLdump on db table fail with "Permission denied", or else it creates a zero KB fileJan Steinman31 Dec
  • Re: why does basic MySQLdump on db table fail with "Permission denied",or else it creates a zero KB fileReindl Harald31 Dec
  • Re: why does basic MySQLdump on db table fail with "Permission denied", or else it creates a zero KB fileGovinda1 Jan
    • Re: why does basic MySQLdump on db table fail with "Permission denied", or else it creates a zero KB fileJan Steinman2 Jan
      • Re: why does basic MySQLdump on db table fail with "Permission denied", or else it creates a zero KB fileGovinda3 Jan
        • Re: why does basic MySQLdump on db table fail with "Permissiondenied", or else it creates a zero KB filehsv4 Jan
          • Re: why does basic MySQLdump on db table fail with "Permission denied", or else it creates a zero KB fileGovinda4 Jan
Re: (off topic) why PATHJan Steinman4 Jan
  • Re: (off topic) why PATHReindl Harald4 Jan