http://blog.csdn.net/AndroidBluetooth/archive/2011/05/04/6394301.aspx
1.为root用户配置环境变量
<1> 编辑目录root下面的profile或者.bash_profile文件,我的ubuntu10.10为.profile
- sudo gedit /root/.profile
<2> 打开文件之后,在文件后面添加
- export PATH=/usr/local/mysql/bin:$PATH
<3> 保存,退出。注销即可!
2. 如果,其他用户想使用MySQL怎么办?so easy,改变配置参数。
<1> 编辑/etc/profile
- sudo gedit /etc/profile
添加下面语句,即可。
- export PATH=/usr/local/mysql/bin:$PATH
如果,已经存在PATH,你就直接在其后加入/usr/local/mysql/bin即可。
<2> 保存,退出。注销即可!
3. 启动MySQL
无论如何,如果你没有配置MySQL随PC启动而启动的话,你需要自己启动:
- su
- cd /user/local/mysql
- ./bin/mysqld_safe --user=mysql &
- ctrl + c
ok,进入数据库吧!
- mysql -u root -p
- (-u root表示用户为root,-p表示密码,这里密码为空)
另外,如果想在开机启动 mysql 可以修改配置文件,该配置文件是 /etc/rc.local,在该文件中加入下面一句:
- /usr/local/mysql/bin/mysqld_safe --user=mysql &
随便说一下,如何开机启动 Tomcat,类似上面的操作,在 /etc/rc.local,在该文件中加入下面两句:
- export JAVA_HOME=/home/mark/android/Java/jdk1.6.0_24
- /home/mark/android/tomcat/bin/startup.sh
完整的该文件是这样子的:
- #!/bin/sh -e
- #
- # rc.local
- #
- # This script is executed at the end of each multiuser runlevel.
- # Make sure that the script will "exit 0" on success or any other