5.7 初始化

最简配置文件

[mysqld]
port=3306    
datadir=/mysql/data/
log_error=/mysql/data/mysql_error.log
basedir=/usr/local/mysql/    

初始化

/usr/local/mysql/bin/mysqld --defaults-file=/home/mysql/my.cnf --initialize --user=mysql

启动数据库

/usr/local/mysql/bin/mysqld_safe --defaults-file=/home/mysql/my.cnf &

初次进入数据库并且修改root密码

[mysql@oracle ~]$ /usr/local/mysql/bin/mysql -uroot -pzVBxY%A,j7hk -h127.1
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.21

Copyright (c) 2000, 2018, 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> alter user root@'127.0.0.1' identified by 'wonima';
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> select user,host from mysql.user;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user root@'localhost' identified by 'wonima';
Query OK, 0 rows affected (0.01 sec)
posted @ 2018-04-20 01:19  Coye  阅读(182)  评论(0编辑  收藏  举报