<script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "image"; //2007-07-26: CSDN google_ad_channel = "6063905817"; google_color_border = "6699CC"; google_color_bg = "E6E6E6"; google_color_link = "FFFFFF"; google_color_text = "333333"; google_color_url = "AECCEB"; google_ui_features = "rc:6"; // --></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
<!--Google 468*60横幅广告结束-->
1)
# groupadd mysql
# useradd mysql -g mysql
2)
进入mysql安装目录后执行
./scripts/mysql_install_db --user=mysql
(初试化表并且规定用mysql用户来访问。初始化表以后就开始给mysql和root用户设定访问权限)
3)
chown -R root .
chown -R mysql data
(data目录里面存的是mysql的数据库文件.这个目录是在/etc/my.cnf中有配置,在mysql_install_db时产生)
chown -R mysql data /.
(设定mysql用户能访问/usr/local/mysql/data/mysql下的所有文件)
chgrp -R mysql .
(设定mysql组能够访问/usr/local/mysql)
4)
启动
./bin/mysqld_safe --user=mysql &
(如果没有问题的话,应该会出现类似这样的提示:
[1] 42264
# Starting mysqld daemon with databases from /usr/local/mysql/var
如果出现 mysql ended这样的语句,表示Mysql没有正常启动,你可以到log中查找问题,Log文件的通常在/etc/my.cnf中配置。大多数问题是权限设置不正确引起的。)
5)
修改默认密码
./bin/mysqladmin -u root password yourpassword
6)
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 700 /etc/init.d/mysqld
# chkconfig --add mysqld
# chkconfig --level 345 mysqld on
(设置使mysql每次启动都能自动运行)
7)
# service mysqld start
# netstat –atln
(启动mysql服务,查看端口号)
service mysqld status(查看服务状态)
service mysqld stop(停止服务)
mysqladmin –u root –p test shutdown(停止mysql)
8)
设置其他机器访问mysql
insert into user(Host,User,Password) values('192.168.117.54','test',password('test'));
flush privileges;
9)
# cp support-files/my-medium.cnf /etc/my.cnf
(使用mysql其他模板覆盖默认模板)
<!--新Google 468*60横幅广告开始-->
<script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; /* 468x60, 创建于 08-8-6 */ google_ad_slot = "7368701459"; google_ad_width = 468; google_ad_height = 60; // --></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
<!--新Google 468*60横幅广告结束--><!--新Google 468x15 横链接单元开始-->
<script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; /* 468x15 横链接单元 */ google_ad_slot = "5785741422"; google_ad_width = 468; google_ad_height = 15; // --></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
<!--新Google 468x15 横链接单元结束-->
转自【http://jythoner.javaeye.com/blog/277778】