建议在Linux中使用RPM包来安装MySQL
本次采用二进制安装(版本为5.7)
To install and use a MySQL binary distribution, the command
sequence looks like this:
shell> groupadd mysql
shell> useradd -r -g mysql mysql--useradd -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> mkdir mysql-files
shell> chmod 770 mysql-files
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql # Before MySQL 5.7.6
shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and up
shell> bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and up
shell> chown -R root .
shell> chown -R mysql data mysql-files
shell> bin/mysqld_safe --user=mysql &--启动mysql服务器
[root@dgryxrdb mysql]# bin/mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data
2015-04-17T02:42:12.943581Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-04-17T02:42:13.359873Z 0 [Warning] InnoDB: New log files created, LSN=45790
2015-04-17T02:42:13.418680Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-04-17T02:42:13.481356Z 0 [Warning] Failed to setup SSL
2015-04-17T02:42:13.481394Z 0 [Warning] SSL error: SSL context is not usable without certificate and private key
2015-04-17T02:42:13.497882Z 1 [Warning] A temporary password is generated for root@localhost: -bb84ecF*!d4
[root@dgryxrdb mysql]# bin/mysql_ssl_rsa_setup
OpenSSL 1.0.1e-fips 11 Feb 2013
Generating a 2048 bit RSA private key
..................................................+++
.........+++
writing new private key to 'ca-key.pem'
-----
writing RSA key
Signature ok
subject=/CN=MySQL_Server_5.7.7-rc_Auto_Generated_CA_Certificate
Getting Private key
Generating a 2048 bit RSA private key
...........................................................................................+++
........+++
writing new private key to 'server-key.pem'
-----
writing RSA key
Signature ok
subject=/CN=MySQL_Server_5.7.7-rc_Auto_Generated_Server_Certificate
Getting CA Private Key
Generating a 2048 bit RSA private key
....................+++
..................................................+++
writing new private key to 'client-key.pem'
-----
writing RSA key
Signature ok
subject=/CN=MySQL_Server_5.7.7-rc_Auto_Generated_Server_Certificate
Getting CA Private Key
server-cert.pem: OK
client-cert.pem: OK
Generating RSA private key, 2048 bit long modulus
........................................+++
..................................................................................................+++
e is 65537 (0x10001)
writing RSA key
[root@dgryxrdb mysql]# mysqld_safe --user=mysql &
[1] 19371
[root@dgryxrdb mysql]# 150417 14:00:53 mysqld_safe Logging to '/usr/local/mysql/data/dgryxrdb.localdomain.err'.
150417 14:00:53 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
安装完毕后可以修改用户权限,否则无法登录 以 --skip-grant-tables登录,修改密码