MySQL安装
Install on Linux
采用二进制方式安装
# 建立用户和组 (Ubuntu等系统下使用-m参数建立home dir)shell>
groupadd mysql
shell>useradd -r -g mysql -d /home/mysql -m -s /bin/bash mysql
shell>
# 解压安装cd /usr/local
shell>tar zxvf
/path/to/mysql-VERSION-OS
.tar.gz
shell>ln -s
full-path-to-mysql-VERSION-OS
mysql
shell>cd mysql
shell>chown -R mysql .
shell>chgrp -R mysql .
shell>
# 初始化数据库scripts/mysql_install_db --user=mysql
shell>chown -R root .
shell>chown -R mysql data
# Next command is optional
shell>cp support-files/my-medium.cnf /etc/my.cnf
# Next command is optional
shell>cp support-files/mysql.server /etc/init.d/mysql.server
# 启动和停止
shell> bin/mysqld_safe --user=mysql &
shell> bin/mysqladmin -uroot shutdown
# 设置root密码
shell> mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('
mysql> newpwd
');SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('
mysql> newpwd
');SET PASSWORD FOR 'root'@'::1' = PASSWORD('
mysql> SET PASSWORD FOR 'root'@'newpwd
');host_name
' = PASSWORD('newpwd
');
# 或者用update语句设置密码
shell>mysql -u root
mysql>UPDATE mysql.user SET Password = PASSWORD('
newpwd
')WHERE User = 'root';
mysql>FLUSH PRIVILEGES;
作者:wait4friend
Weibo:@wait4friend
Twitter:@wait4friend
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
posted on 2012-01-29 10:14 wait4friend 阅读(473) 评论(0) 编辑 收藏 举报