MySQL 的問題~



贊助商連結


Man
2002-01-14, 06:05 PM
各位好~
我是用 RedHat 7.2 的...
裝了 MySQL ...
我是用 tarball 的方式來安裝的,
記得以前用 7.0 時,我是選預設的『everything』的...
所以它是預設便安裝了 MySQL 、那麼只要我打 mysql 便會可以進入 mysql 埵b設定...
但是現在我自行編譯後,安裝的位置和預設的不同...
所以我打 mysql 也不行進入 mysql 了;如要進入,一定要輸入絕路徑...
但是我有什麼方法可以像以前那樣只要輸入 mysql 便能進入 mysql 作設定呢?
希望各位能指點指點!謝謝!:(

贊助商連結


repsol
2002-01-14, 11:21 PM
應該是你的環境變數沒有設好
先看看你的shell是那一種,然後在自己的home目錄下設好..或是/etc下設好
很類似win98的set path那種環境變數
一般大家都會使用tcsh或是bash
兩種shell的環境變數不太一樣..


mysql 一般裝好都會放在/usr/local/bin/下...
除非你安裝的時候有特別指定路徑
./configure --prefix=/usr/local/mysql...等..那令當別論
找找看..用whereis 找找..

repsol
2002-01-14, 11:44 PM
For tcsh :


man 1 csh


NAME
tcsh - C shell with file name completion and command line
editing


.............


path A list of directories in which to look for exe?
cutable commands. A null word specifies the cur?
rent directory. If there is no path variable then
only full path names will execute. path is set by
the shell at startup from the PATH environment
variable or, if PATH does not exist, to a system-
dependent default something like `(/usr/local/bin
/usr/bsd /bin /usr/bin .)'. The shell may put `.'
first or last in path or omit it entirely depend?
ing on how it was compiled; see the version shell
variable. A shell which is given neither the -c
nor the -t option hashes the contents of the
directories in path after reading ~/.tcshrc and
each time path is reset. If one adds a new com?
mand to a directory in path while the shell is
active, one may need to do a rehash for the shell
to find it.

repsol
2002-01-14, 11:57 PM
For bash


man bash


When bash is invoked as an interactive login shell, or as
a non-interactive shell with the --login option, it first
reads and executes commands from the file /etc/profile, if
that file exists. After reading that file, it looks for
~/.bash_profile, ~/.bash_login, and ~/.profile, in that
order, and reads and executes commands from the first one
that exists and is readable. The --noprofile option may
be used when the shell is started to inhibit this behav-
ior.
When a login shell exits, bash reads and executes commands
from the file ~/.bash_logout, if it exists.

When an interactive shell that is not a login shell is
started, bash reads and executes commands from ~/.bashrc,
if that file exists. This may be inhibited by using the
--norc option. The --rcfile file option will force bash
to read and execute commands from file instead of
~/.bashrc.

repsol
2002-01-15, 12:09 AM
For BASH

ex :

$HOME/.profile

PATH=/sbin:/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin; export PATH


For TCSH

ex :


$HOME/.cshrc


set path = (/bin /sbin /bin /usr/sbin /usr/bin /usr/local/libexec /usr/local/sbin /usr/local/bin )

edwang
2002-01-15, 10:35 AM
我是在FreeBSD上用手動編譯法安裝的...你只要找出mysql這個執行檔的位置,就可以了

ex.
mysql: /usr/local/mysql/bin/mysql

cp /usr/local/mysql/bin/mysql* /usr/local/bin

reboot後就好了...

Man
2002-01-15, 11:49 AM
嗯~多謝你們的指點~:rolleyes:
我已成功解決問題了,
我的 MySQL 是裝在 /usr/local/mysql 上...
我在我的 home directory 堛 .bash_profile 內加上 /usr/local/mysql/bin ...
結果便行了...
真的十分多謝你們的指點!謝謝!:rolleyes:

VBird
2002-01-15, 12:03 PM
最初由 Man 發表
各位好~
我是用 RedHat 7.2 的...
裝了 MySQL ...
我是用 tarball 的方式來安裝的,
記得以前用 7.0 時,我是選預設的『everything』的...
所以它是預設便安裝了 MySQL 、那麼只要我打 mysql 便會可以進入 mysql 埵b設定...
但是現在我自行編譯後,安裝的位置和預設的不同...
所以我打 mysql 也不行進入 mysql 了;如要進入,一定要輸入絕路徑...
但是我有什麼方法可以像以前那樣只要輸入 mysql 便能進入 mysql 作設定呢?
希望各位能指點指點!謝謝!:(
Red Hat 預設的 mysql 這個執行檔案放置在 /usr/bin/mysql 底下,
所以你只要進入 /usr/bin 執行:

ln -s /usr/local/mysql/bin/mysql mysql

上面的 /usr/local/mysql/bin/mysql 與您的 mysql 執行檔的絕對路徑有關!
如此一來,當你執行 mysql 時,將會自動指到你的 mysql 所在路徑去囉!
試試看吧! :D

Man
2002-01-15, 12:18 PM
最初由 VBird 發表

Red Hat 預設的 mysql 這個執行檔案放置在 /usr/bin/mysql 底下,
所以你只要進入 /usr/bin 執行:

ln -s /usr/local/mysql/bin/mysql mysql

上面的 /usr/local/mysql/bin/mysql 與您的 mysql 執行檔的絕對路徑有關!
如此一來,當你執行 mysql 時,將會自動指到你的 mysql 所在路徑去囉!
試試看吧! :D

嗯~謝謝你的指點啊!:rolleyes:
但我還想問問,
我怎樣知道那個是 mysql 的執行檔呢?
我的 mysql 是裝在 /usr/local/mysql 堛...
那麼 /usr/local/mysql/bin/mysql 便是我的執行檔了嗎?
即 /bin 不的 mysql 便是我的執行檔了嗎?
希望各位能再指點指點!謝謝!:rolleyes: