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

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

 

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

 

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

 

[java]  view plain copy print ?
  1. sudo gedit /root/.profile  
 

 

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

 

[java]  view plain copy print ?
  1. export PATH=/usr/local/mysql/bin:$PATH  
 

 

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

 

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

 

<1> 编辑/etc/profile

 

[java]  view plain copy print ?
  1. sudo gedit /etc/profile  
 

 

添加下面语句,即可。

 

[java]  view plain copy print ?
  1. export PATH=/usr/local/mysql/bin:$PATH  
 

 

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

 

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

 

3. 启动MySQL


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

 

[java]  view plain copy print ?
  1. su  
  2. cd /user/local/mysql  
  3. ./bin/mysqld_safe --user=mysql &  
  4. ctrl + c  
 

 

ok,进入数据库吧!

 

[java]  view plain copy print ?
  1. mysql -u root -p  
  2. (-u root表示用户为root,-p表示密码,这里密码为空)  
 

 

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


[java]  view plain copy print ?
  1. /usr/local/mysql/bin/mysqld_safe --user=mysql &  

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


[java]  view plain copy print ?
  1. export JAVA_HOME=/home/mark/android/Java/jdk1.6.0_24  
  2. /home/mark/android/tomcat/bin/startup.sh  

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

[java]  view plain copy print ?
  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  
  7. # value on error.  
  8. #  
  9. # In order to enable or disable this script just change the execution  
  10. # bits.  
  11. #  
  12. # By default this script does nothing.  
  13.   
  14. #start the os and start tomcat  
  15. export JAVA_HOME=/home/mark/android/Java/jdk1.6.0_24  
  16. /home/mark/android/tomcat/bin/startup.sh  
  17.   
  18. #start the os and start mysql  
  19. /usr/local/mysql/bin/mysqld_safe --user=mysql &  
  20.   
  21. exit 0  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值