网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

MySQL5.7.28初始化数据库

1)初始化随机密码    MySQLd --initialize 

10余年的坡头网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。网络营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整坡头建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联从事“坡头网站设计”,“坡头网站推广”以来,每个客户项目都认真落实执行。

[root@host-172-16-61-102 bin]# ./mysqld --initialize

2020-02-15T07:01:38.309015Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2020-02-15T07:01:38.309069Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.

2020-02-15T07:01:38.497402Z 0 [Warning] InnoDB: New log files created, LSN=45790

2020-02-15T07:01:38.541219Z 0 [Warning] InnoDB: Creating foreign key constraint system 

tables.

2020-02-15T07:01:38.553509Z 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: 02fb69c1-4fc1-11ea-8b4e-fa163d34f78d.

2020-02-15T07:01:38.556591Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2020-02-15T07:01:38.980429Z 0 [Warning] CA certificate ca.pem is self signed.

2020-02-15T07:01:39.723869Z 1 [Note] A temporary password is generated for root@localhost: +:NoRLu2kwhd

生成的密码是:+:NoRLu2kwhd

以上的指令,默认读取配置文件/etc/my.cnf,需要/etc/my.cnf文件中指定了数据库的地址,并且生成一个root用户的密码,还有如下的参数可以设置

--user=mysql  //生成指定用户的密码

--datadir=/opt/mysql/mysql/data  //指定生成的数据库数据地址

--defaults-file=/opt/mysql/mysql/etc/my.cnf//指定读取的配置文件,取代默认的配置

2)初始化空密码    mysqld --initialize-insecure

启动mysqld服务 ./mysqld --user=root

创建密码

[root@host-172-16-61-102 bin]# mysql -uroot -p

//提示密码输入,直接回车

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

Your MySQL connection id is 11

Server version: 5.7.28 MySQL xxx

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

//为root创建密码

MySQL [(none)]> set password = password("root");

Query OK, 0 rows affected, 1 warning (0.00 sec)

MySQL [(none)]> quit

注意:执行“mysqld  --initialize”报错了。提示“initialize specified but the data directory has files in it. Aborting”,大意是提示/opt/mysql/mysql/data数据库地址下有文件,导致无法初始化数据库,这个时候,可以进入到该目录,将所有的数据删除,说明之前已经初始化过


文章名称:MySQL5.7.28初始化数据库
当前链接:http://bjjierui.cn/article/gegsis.html

其他资讯