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

定制建站费用3500元

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

成都品牌网站建设

品牌网站建设费用6000元

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

成都商城网站建设

商城网站建设费用8000元

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

成都微信网站建设

手机微信网站建站3000元

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

建站知识

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

怎么初始化MySQL数据库-创新互联

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

成都创新互联公司是创新、创意、研发型一体的综合型网站建设公司,自成立以来公司不断探索创新,始终坚持为客户提供满意周到的服务,在本地打下了良好的口碑,在过去的10年时间我们累计服务了上千家以及全国政企客户,如成都护栏打桩机等企业单位,完善的项目管理流程,严格把控项目进度与质量监控加上过硬的技术实力获得客户的一致称誉。

[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数据库地址下有文件,导致无法初始化数据库,这个时候,可以进入到该目录,将所有的数据删除,说明之前已经初始化过

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


当前题目:怎么初始化MySQL数据库-创新互联
标题链接:http://bjjierui.cn/article/eepcp.html

其他资讯