shell> groupadd mysql
shell> useradd -r -g mysql 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
shell> cp support-files/mysql.server /etc/init.d/mysql.server
shell> useradd -r -g mysql 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
shell> bin/mysqld_safe --user=mysql &
shell> ./bin/mysqladmin -u root password 'new-password'
shell> ./bin/mysqladmin -uroot -ppassw0rd shutdown
shell> cp support-files/mysql.server /etc/init.d/mysql.server
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h benny-Aspire-V5-471G password 'new-password'
bin/mysqld_safe --user=mysql 是在安全模式启动mysql,主要是用于配置root的密码。
/bin/mysqladmin -u root password 'new-password' 配置root用户的密码,前提是必须安全模式启动了mysql服务。
/bin/mysqladmin -uroot -ppassw0rd shutdown 关闭安全启动模式的服务
启动mysql服务,sudo /etc/init.d/mysql.server start
关闭mysql服务,sudo /etc/init.d/mysql.server stop