现在的位置: 首页 > 综合 > 正文

MySQL: ubuntu10.10下配置环境变量

2013年08月04日 ⁄ 综合 ⁄ 共 1298字 ⁄ 字号 评论关闭

http://blog.csdn.net/AndroidBluetooth/archive/2011/05/04/6394301.aspx

 

1.为root用户配置环境变量

 

<1> 编辑目录root下面的profile或者.bash_profile文件,我的ubuntu10.10为.profile

 

  1. sudo gedit /root/.profile  

 

 

<2> 打开文件之后,在文件后面添加

 

  1. export PATH=/usr/local/mysql/bin:$PATH  

 

 

<3> 保存,退出。注销即可!

 

2. 如果,其他用户想使用MySQL怎么办?so easy,改变配置参数。

 

<1> 编辑/etc/profile

 

  1. sudo gedit /etc/profile  

 

 

添加下面语句,即可。

 

  1. export PATH=/usr/local/mysql/bin:$PATH  

 

 

如果,已经存在PATH,你就直接在其后加入/usr/local/mysql/bin即可。

 

<2> 保存,退出。注销即可!

 

3. 启动MySQL


无论如何,如果你没有配置MySQL随PC启动而启动的话,你需要自己启动:

 

  1. su  
  2. cd /user/local/mysql  
  3. ./bin/mysqld_safe --user=mysql &  
  4. ctrl + c  

 

 

ok,进入数据库吧!

 

  1. mysql -u root -p  
  2. (-u root表示用户为root,-p表示密码,这里密码为空)  

 

 

另外,如果想在开机启动 mysql 可以修改配置文件,该配置文件是 /etc/rc.local,在该文件中加入下面一句:

  1. /usr/local/mysql/bin/mysqld_safe --user=mysql &  

随便说一下,如何开机启动 Tomcat,类似上面的操作,在  /etc/rc.local,在该文件中加入下面两句:

  1. export JAVA_HOME=/home/mark/android/Java/jdk1.6.0_24  
  2. /home/mark/android/tomcat/bin/startup.sh  

完整的该文件是这样子的:

  1. #!/bin/sh -e  
  2. #  
  3. # rc.local  
  4. #  
  5. # This script is executed at the end of each multiuser runlevel.  
  6. # Make sure that the script will "exit 0" on success or any other  

抱歉!评论已关闭.