添加mysql用户:
groupadd mysql
useradd mysql -g mysql
安装mysql:
cd mysql-5.0.16
./configure --prefix=/usr/local/mysql --with-charset=gbk --with-extra-charsets="gbk gb2312" && make && make install
安装后配置:
scripts/mysql_install_db
cd /usr/local/
mkdir ./mysql/var
chown -R mysql ./mysql
chown -R mysql ./mysql/var
chgrp -R mysql ./mysql
启动服务:
/usr/local/mysql/bin/mysqld_safe --user=mysql --default-character-set=gbk &
如果想做成服务,那么:
cp /usr/local/mysql/share/mysql/mysql.server \
/etc/rc.d/init.d/
mv mysql.server mysqld
chkconfig --add mysqld
chkconfig mysqld on
service mysqld start
连接测试,这时root的密码是NULL:
/usr/local/mysql/bin/mysql -hlocalhost -uroot
设置root的密码:
/usr/local/mysql/bin/mysqladmin -uroot password 密码
注意:
在进入数据库后,立马设置权限吧,否则可能出现无法远程登录的尴尬(今天刚犯这个错误,还以为是服务器设置了防火墙呢):
为root开放所有数据库的所有权限,很大的权限,慎用:
grant all on *.* to root@'%' identified by 'password';
flush privileges;
阅读(1564) | 评论(0) | 转发(0) |