mysql 常用语句
mysql bat 文件
c:
cd C:\Program Files\MySQL\MySQL Server 5.5\bin
##for /f "tokens=2 delims=:" %%i in ('ipconfig ^|findstr /i "ip address"') do set ip=%%i
##echo %ip%
set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%"
echo %ymd%
mysqldump -u a -pa pwvm > d:\pwvm__%ymd%_dump.sql
mysqldump -u a -pa monitor > d:\monitor_%ymd%_dump.sql
copy d:\pwvm__%ymd%_dump.sql \\10.10.55.140\140共享\db\dump
copy d:\monitor_%ymd%_dump.sql \\10.10.55.140\140共享\db\dump
-----------------------
创建用户
CREATE USER 'a'@'%' IDENTIFIED BY 'a';
GRANT all ON *.* TO 'a'@'%';
CREATE SCHEMA `pwvm` DEFAULT CHARACTER SET utf8 ;
CREATE SCHEMA `monitor` DEFAULT CHARACTER SET utf8 ;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD("a");
------------------------------------------------------
赋权限
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;