Ubuntu安装MySQL
好久没写日志了,前段时间,域名没有备案,封掉了。
Ubuntu安装MySQL很方便,直接运行
sudo apt-get install mysql-server
就可以了。
但如果要MySQL能够外部访问的话,要做下修改。
登录MySQL
mysql -u root -p
授予需要外部访问的IP或者用户的权限
GRANT ALL PRIVILEGES ON *.* TO shishuo@'%' IDENTIFIED BY "shishuopassword";
其中 *.* 表示 数据库.表,你可以写为 shishuo.*
如:
GRANT ALL PRIVILEGES ON shishuodatabase.* TO shishuo@'%' IDENTIFIED BY "shishuopassword";
这条语句的意思就是,shishuo这个用户可以在任何IP下,用 shishuopassword 密码,访问shishuodatabase数据库,并具有对shishuodatabase的所有权限。
然后
vi /etc/mysql/my.cnf
修改
bind-address = 127.0.0.1
为
#bind-address = 127.0.0.1
重启
/etc/init.d/mysql restart
这样外部也能访问了。
| Print article | This entry was posted by Herbert on 2010/01/07 at 14:02, and is filed under Database, Linux. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |