MySQL 5.7.15 安装(二进制安装模式)
2016-11-15 12:45
309 查看
MySQL 5.7.1x 比以往版本安装有些不一样,第一次安装5.7,安装过程遇到挺多小问题,现简单总结安装过程如下。
这次安装的是 mysql-5.7.16-linux-glibc2.5-i686.tar.gz,更多下载参考MySQL
安装(二进制安装模式),
安装相关包(依赖包自动安装):
配置文件:
http://dev.mysql.com/doc/refman/5.7/en/binary-installation.html
安装:
注意:数据库账号 root@localhost 的密码自动随机生成 AbC#c*hiy0bl (如上所示),登录后要求必须先改密码。(可查看日志信息)
配置服务:
添加环境变量:
访问数据库:
如果访问忘记密码,错误如下:
解决:
这次安装的是 mysql-5.7.16-linux-glibc2.5-i686.tar.gz,更多下载参考MySQL
安装(二进制安装模式),
安装相关包(依赖包自动安装):
yum -y install gcc glibc libaio libstdc++ libstdc libncurses ld-linux
配置文件:
shell> vi /etc/my.cnf [client] port = 3306 socket = /tmp/mysql.sock [mysqld] user=mysql port = 3306 server_id = 1 socket=/tmp/mysql.sock basedir =/usr/local/mysql datadir =/usr/local/mysql/data pid-file=/usr/local/mysql/data/mysqld.pid log-error=/usr/local/mysql/log/mysql-error.log# 官网安装参考
http://dev.mysql.com/doc/refman/5.7/en/binary-installation.html
shell> groupadd mysql shell> useradd -r -g mysql -s /bin/false 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 750 mysql-files shell> chown -R mysql . shell> chgrp -R mysql . shell> scripts/mysql_install_db --user=mysql# MySQL 5.7.0 to 5.7.4 shell> bin/mysql_install_db --user=mysql # MySQL 5.7.5 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 & # Next command is optional shell> cp support-files/mysql.server /etc/init.d/mysql.server
安装:
shell> tar -xvf mysql-5.7.16-linux-glibc2.5-i686.tar.gz shell> mv mysql-5.7.16-linux-glibc2.5-i686 /usr/local/ shell> cd /usr/local/ shell> ln -s mysql-5.7.16-linux-glibc2.5-i686 mysql shell> groupadd mysql shell> useradd -r -g mysql -s /bin/false mysql shell> cd mysql shell> chown -R mysql:mysql . shell> bin/mysqld --defaults-file=/etc/my.cnf --initialize --user=mysql --explicit_defaults_for_timestamp
[root@centos224 mysql]# bin/mysqld --defaults-file=/etc/my.cnf --initialize --user=mysql --explicit_defaults_for_timestamp 2016-11-22T14:14:53.799055Z 0 [Warning] InnoDB: New log files created, LSN=45790 2016-11-22T14:14:54.208059Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2016-11-22T14:14:54.371661Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 0a41777d-b0be-11e6-b802-000c29b81537. 2016-11-22T14:14:54.405756Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2016-11-22T14:14:54.417890Z 1 [Note] A temporary password is generated for root@localhost: AbC#c*hiy0bl [root@centos224 mysql]#
注意:数据库账号 root@localhost 的密码自动随机生成 AbC#c*hiy0bl (如上所示),登录后要求必须先改密码。(可查看日志信息)
配置服务:
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld # chkconfig mysqld on # service mysqld start # service mysqld restart # service mysqld stop
添加环境变量:
# vi /etc/profile export PATH=$PATH:/usr/local/mysql/bin # source /etc/profile
访问数据库:
# mysql -u root -p Enter password:AbC#c*hiy0bl
如果访问忘记密码,错误如下:
# mysql # mysqladmin -u root password "mysql"ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解决:
# service mysqld stop # cd /usr/local/mysql/bin # mysqld_safe --skip-grant-tables & --(再打开另一命令行窗口,直接访问数据库并设置密码) # source /etc/profile # mysql -u root mysql> mysql> use mysql; mysql> select Host,User from user; mysql> update user set authentication_string=password("mysql") where user="root" and Host = 'localhost'; mysql> flush privileges; mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'mysql';
相关文章推荐
- MySQL 5.7.15 多实例安装(二进制安装模式)
- MySQL 安装(二进制安装模式)
- MySQL 5.7.15 安装 (二进制版本)
- linux下给php安装pdo_mysql和zlib以及测试模式的选择(禅道安装过程中遇到的问题)
- Linux 下 二进制源码包安装mysql 详细过程
- mysql二进制包的安装position
- mysql二进制安装过程
- linux下mysql二进制编译安装并开机启动
- mysql二进制非root用户安装后启动mysqld的路径不对的问题
- window XP安装 apache 2.2.19 + 要下载二进制的php5.3.6 + Mysql 5.5配置(彻底解决 Fatal error: Class 'mysqli' not found in )
- mysql的二进制high安装
- 使用二进制的方式安装mysql实践纪要
- mysql二进制版本的安装
- Mysql源码和二进制安装
- 二进制编译安装mysql
- Centos 下同时安装 Mysql4 和 Mysql5,二进制方式
- windows非安装模式下添加apache和mysql服务
- mysql 二进制编译安装
- Ubuntu,Mysql二进制安装流程以及常见错误