zoukankan      html  css  js  c++  java
  • MySQL 的一些批处理

    执行 SQL 脚本文件(https://blog.csdn.net/vebasan/article/details/7619911):

    mysql –u root –p 123456 < script.sql

    卸载 MySQL(需手动删除文件):

    @echo off
    echo ==========获取管理员权限...=========
    %1 %2
    ver|find "5.">nul&&goto :gotAdmin
    mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :gotAdmin","","runas",1)(window.close)&goto :eof
    :gotAdmin
    cd /d %~dp0
    echo ==========停止服务...===============
    net stop MySQL
    echo ==========删除服务...===============
    binmysqld --remove
    echo ==========结束!====================
    pause

    安装 MySQL(my.ini 这里是在上级文件夹中存储):

    @echo off
    echo ==========获取管理员权限...==========================
    %1 %2
    ver|find "5.">nul&&goto :gotAdmin
    mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :gotAdmin","","runas",1)(window.close)&goto :eof
    :gotAdmin
    cd /d %~dp0
    echo ==========安装服务...================================
    binmysqld --install MySQL --defaults-file=%~dp0my.ini
    echo ==========初始化...(datadir 目录必须为空)==========
    binmysqld --defaults-file=%~dp0my.ini --initialize-insecure --console
    echo ==========运行服务...================================
    net start MySQL
    echo ==========修改 root 密码...==========================
    binmysql -u root --skip-password < change_password.sql
    echo ==========结束!=====================================
    pause

    change_password.sql

    ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
    exit
  • 相关阅读:
    PG中 generate_series函数的使用
    代码搜索神器ag
    效率神器2
    效率神器
    Django-cookie组件
    Django-form组件
    Django组件-分页器
    Django与Ajax
    Django-模型层
    Django-模板层
  • 原文地址:https://www.cnblogs.com/xwgli/p/11151264.html
Copyright © 2011-2022 走看看