鲲鹏平台ARM版centos安装源码包mysql5.7(二)

举报
snowofsummer 发表于 2020/08/03 09:35:48 2020/08/03
【摘要】 mysql初始化,建立数据库。1,建立mysql用户.useradd mysql2,设置安装软件权限chown mysql:mysql /usr/local/mysql/ -R3,建立相关目录mkdir -p /data/datamkdir /data/logmkdir /data/runtouch /data/log/mysql.logchown mysql:mysql -R /data/...

mysql初始化,建立数据库。

1,建立mysql用户.

useradd mysql

2,设置安装软件权限

chown mysql:mysql /usr/local/mysql/ -R

3,建立相关目录

mkdir -p /data/data

mkdir /data/log

mkdir /data/run

touch /data/log/mysql.log

chown mysql:mysql -R /data/

4,初始化数据库

 /usr/local/mysql/bin/mysqld --initialize --basedir=/usr/local/mysql --datadir=/data/data --user=mysql

#随机产生root密码:

2020-08-03T01:26:29.757709Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2020-08-03T01:26:29.913125Z 0 [Warning] InnoDB: New log files created, LSN=45790

2020-08-03T01:26:30.413112Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2020-08-03T01:26:30.422503Z 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: 5bd39e9c-d528-11ea-8914-fa163e39b521.

2020-08-03T01:26:30.424433Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2020-08-03T01:26:30.858360Z 0 [Warning] CA certificate ca.pem is self signed.

2020-08-03T01:26:31.197898Z 1 [Note] A temporary password is generated for root@localhost: ewsr,oe370&P

5,配置/etc/my.cnf参数文件

[mysqld]

datadir=/data/data

socket=/data/data/mysql.sock

[mysqld_safe]

log-error=/data/log/mysql.log

pid-file=/data/run/mysql.pid


6,配置mysql开机自动启动。

cp support-files/mysql.server /etc/init.d/

chmod +x /etc/init.d/mysql.server 


7,启动mysql

/etc/init.d/mysql.server start

Starting MySQL.                                            [  OK  ]


8,登陆mysql设置root密码

/usr/local/mysql/bin/mysql --socket=/data/data/mysql.sock -uroot -p

Enter password: 

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

Your MySQL connection id is 4

Server version: 5.7.28

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

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

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=password('root');

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

mysql> exit

Bye


【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。