mysql数据库,如何进行数据目录的初始化操作
需求描述:
当将mysql的二进制包解压之后,只有通过初始化数据库的数据目录,创建系统表之后才能使用mysql Server
数据库版本:5.5.57-log
操作过程:
1.通过解压之后的mysql包中scripts目录下的mysql_install_db脚本对DB进行初始化
[mysql@redhat6 mysql]$ scripts/mysql_install_db --user=mysql #通过--user=mysql来确定是使用哪个用户来初始化数据库,即通过哪个用户来运行数据库 Installing MySQL system tables... #安装Mysql的系统表 180408 9:56:48 [Warning] option 'slow_query_log': boolean value '/mysql/data/log/slow-query.log' wasn't recognized. Set to OFF. 180408 9:56:48 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set 180408 9:56:48 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 180408 9:56:48 [Note] /mysql/mysql/bin/mysqld (mysqld 5.5.57-log) starting as process 2722 ... 180408 9:56:48 [Warning] You need to use --log-bin to make --binlog-format work. OK Filling help tables... #增加help表 180408 9:56:48 [Warning] option 'slow_query_log': boolean value '/mysql/data/log/slow-query.log' wasn't recognized. Set to OFF. 180408 9:56:48 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set 180408 9:56:48 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 180408 9:56:48 [Note] /mysql/mysql/bin/mysqld (mysqld 5.5.57-log) starting as process 2729 ... 180408 9:56:48 [Warning] You need to use --log-bin to make --binlog-format work. OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /mysql/mysql/bin/mysqladmin -u root password 'new-password' #为root用户设置密码 /mysql/mysql/bin/mysqladmin -u root -h redhat6 password 'new-password' Alternatively you can run: /mysql/mysql/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /mysql/mysql ; /mysql/mysql/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /mysql/mysql/mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/
备注:在我的这个环境中,已经配置了/etc/my.cnf,里面设置datadir选项指明了将data目录存放的位置.
小结:
mysql_install_db脚本的作用就是初始化数据库,创建系统表.
文档创建时间:2018年4月8日21:52:09
分类:
(02)mysql
标签:
mysql初始化数据目录
, mysql数据库安装系统表
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!