时间:2021-07-01 10:21:17 帮助过:34人阅读
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('
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
');
bitsCN.com# 或者用update语句设置密码
shell>mysql -u root
mysql>UPDATE mysql.user SET Password = PASSWORD('
newpwd
')WHERE User = 'root';
mysql>FLUSH PRIVILEGES;