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 @   Coye  阅读(185)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· DeepSeek在M芯片Mac上本地化部署
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能
点击右上角即可分享
微信分享提示