鲲鹏平台ARM版centos安装源码包mysql5.7(二)
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
- 点赞
- 收藏
- 关注作者
评论(0)