mysql5.7.9安装步骤

时间:2025-07-11

mysql5.7.9安装步骤,二进制包方法,里面有遇到问题和解决办法

安装版本:mysql-5.7.9-linux-glibc2.5-i686 (二进制包)

操作环境:Red Hat Enterprise Linux Server release 5.8 (Tikanga)

(lsb_release -a)

安装步骤:

准备:创建mysql组和用户 [root@hucc /]#groupaddmysql

[root@hucc /]#useradd -r -g mysql mysql

1.rz将mysql安装包传到虚拟机的/usr/local/src

[root@huccsrc]# tar zxvfmysql-5.7.9-linux-glibc2.5-i686.tar

[root@huccsrc]#cpmysql-5.7.9-linux-glibc2.5-i686 /usr/local/mysql/

[root@hucc local]#chown –R mysql:mysqlmysql

[root@huccmysql]# mkdir data

[root@huccmysql]#pwd

/var/lib/mysql

[root@huccmysql]#chown –R mysql:mysql data

[root@huccmysql]#sumysql

[mysql@hucc /]$ /usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/var/lib/mysql/data

2.安装数据库

[mysql@huccmysql]$ /usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/var/lib/mysql/data/

2015-11-11 11:16:51 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize 2015-11-11 11:17:02 [WARNING] The bootstrap log isn't empty:

2015-11-11 11:17:02 [WARNING] 2015-11-11T03:16:51.695249Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead

2015-11-11T03:16:51.696235Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)

2015-11-11T03:16:51.696248Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

注:datadir参数:该参数指定了 MySQL 的数据库文件放在什么路径下。数据库文件即我们常说的 MySQL data 文件

basedir参数:该参数指定了安装 MySQL 的安装路径,填写全路径可以解决相对路径所造成的问题。 每次执行命令,都要注意这两个参数的路径是否正确

3.初始化数据库

[mysql@hucc data]$ /usr/local/mysql/bin/mysqld --initialize --datadir=/var/lib/mysql/data/

2015-11-11T03:21:48.753914Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)

2015-11-11T03:21:48.754043Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

2015-11-11T03:21:48.754228Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2015-11-11T03:21:53.407740Z 0 [Warning] InnoDB: New log files created, LSN=45790

2015-11-11T03:21:53.835859Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2015-11-11T03:21:53.902132Z 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: 5b2484fb-8823-11e5-861b-000c2939111e.

2015-11-11T03:21:53.906476Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

mysql5.7.9安装步骤,二进制包方法,里面有遇到问题和解决办法

2015-11-11T03:21:53.934071Z 1 [Note] A temporary password is generated for root@localhost: gp1qA233.s4W

问题:

[mysql@huccmysql]$ /usr/local/mysql/bin/mysqld --initialize --datadir=/var/lib/mysql/data/

2015-11-11T03:19:58.580635Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)

2015-11-11T03:19:58.580897Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

2015-11-11T03:19:58.581086Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2015-11-11T03:19:58.583953Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. 2015-11-11T03:19:58.584183Z 0 [ERROR] Aborting

处理方法

cd /var/lib/mysql/data 目录下执行rm –rf *

在安装前执行过这个步骤,为什么初始化还要再执行一次

4.启动mysql服务

[mysql@huccmysql]$/usr/local/mysql/bin/mysqld_safe --basedir=/usr/local/mysql --datadir=/var/lib/mysql/data/

151111 11:48:24 mysqld_safe Logging to '/var/lib/mysql/data//http://www.77cn.com.cn.err'.

151111 11:48:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql/data/

[mysql@hucc root]$ /usr/local/mysql/bin/mysqld_safe --basedir=/usr/local/mysql --datadir=/var/lib/mysql/data/ Usage: grep [OPTION]... PATTERN [FILE]...

Try `grep --help' for more information.

grep: write error: 断开的管道

151111 11:52:27 mysqld_safe Logging to '/var/lib/mysql/data//http://www.77cn.com.cn.err'.

151111 11:52:27 mysqld_safeAmysqld process already exists

[mysql@hucc root]$ netstat -altn | grep 3306

tcp 0 0 :::3306 :::* LISTEN

[mysql@hucc root]$ /usr/local/mysql/bin/mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.7.9

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

mysql5.7.9安装步骤,二进制包方法,里面有遇到问题和解决办法

affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password for root@localhost=password('asd123'); Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> exit

Bye

修改密码set password for root@localhost=password('asd123');

…… 此处隐藏:2684字,全部文档内容请下载后查看。喜欢就下载吧 ……
mysql5.7.9安装步骤.doc 将本文的Word文档下载到电脑

    精彩图片

    热门精选

    大家正在看

    × 游客快捷下载通道(下载后可以自由复制和排版)

    限时特价:7 元/份 原价:20元

    支付方式:

    开通VIP包月会员 特价:29元/月

    注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
    微信:fanwen365 QQ:370150219