MySQL数据库运维管理

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
➢ 以主进程mysqld方式启动: • $BASEDIR/bin/mysqld –defaults-file=/etc/my.cnf &
04 MySQL运维管理
➢ 以守护进程mysqld_safe( SHELL脚本)方式启动: • $BASEDIR/bin/mysqld_safe –defaults-file=/etc/my.cnf &
mysql5.6: # cp $BASEDIR/support-files/my-default.cnf /etc/my.cnf # Vi /etc/my.cnf
mysql5.7: # Vi /etc/my.cnf
04 MySQL运维管理
➢ 编辑初始化参数文件my.cnf
[client] port = socket = user = port = ...
技术创新,ຫໍສະໝຸດ Baidu革未来
MySQL数据库运维管理
MySQL数据库运维管理
04 MySQL运维管理
➢ 参数文件位置:
直接运行可执行文件mysqld: [root@master ~]# which mysqld [root@master ~]# ps -ef|grep mysqld|grep -v grep [root@master ~]# /mysql/app/bin/mysqld --verbose --help|grep -A 1 "Default options" ……………… Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf ………………
➢ 以多实例进程mysqld_multi(SHELL脚本)方式启动: • $BASEDIR/bin/mysqld_multi –defaults-file=/etc/my.cnf &
04 MySQL运维管理
✓ 检查监听端口:
✓ 修改MySQL系统账户root@localhost密码: Mysql5.6: /usr/local/mysql/mysqladmin -u root password 'mysql' –S /tmp/mysql3306.sock Mysql5.7: /usr/local/mysql/mysqladmin -u root password '/ai+&+HhX8kw' –S /tmp/mysql3307.sock
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
-u:用户名 -p:密码 -D:数据库名 -s:Socket套接字文件
此种方式只能用于本地连接。
Your MySQL connection id is 16425
Server version: 5.7.21-log MySQL Community Server (GPL)
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] auto-rehash prompt = "\\u@\\h \\R:\\m:\\s [\d]>" ...
[mysqld]
user = port = basedir = datadir = ... innodb ...
[] quick max_allowed_packet = ...
http://imysql.com/my-cnf-wizard.html
04 MySQL运维管理
✓ 数据库登录(连接):
[root@MYSQL01 ~]# mysql -uroot -pmysql
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
mysql> show global variables like 'port';
+
++
| Variable_name | Value |
+
++
| port | 3306 |
+
++
1 row in set (0.00 sec)
04 MySQL运维管理
➢ Socket方式连接
[mysql@VAGE01 ~]$ mysql -usystem -pOracle1 -Dvage -S /data/mysqldata/mysql1/mysql.sock 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 4
只供参考学习!!
04 MySQL运维管理
➢ 创建服务方式启动( SHELL脚本): • cp $BASEDIR/support-files/mysql.server /etc/init.d/mysql • 授予执行权限、配置MySQL服务开机自启动 • 启动MySQL服务service mysql start、systemctl start mysql
相关文档
最新文档