bitscn.com
install on linux
采用二进制方式安装
# 建立用户和组
shell> groupadd mysql
shell> useradd -r -g mysql -d /home/mysql -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('newpwd');
mysql> set password for 'root'@'127.0.0.1' = password('newpwd');
mysql> set password for 'root'@'::1' = password('newpwd');
mysql> set password for 'root'@'host_name' = password('newpwd');
# 或者用update语句设置密码
shell> mysql -u root
mysql> update mysql.user set password = password('newpwd') where user = 'root';
mysql> flush privileges;
bitscn.com