sql 随机收集mysql语句

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 随机收集mysql语句相关的知识,希望对你有一定的参考价值。

-- REVOKE [type of permission] ON [database name].[table name] FROM ‘[username]’@‘localhost’;
-- GRANT SELECT , INSERT , UPDATE , DELETE ON  `[DATABASE]` . * TO  ‘[USER]’@'[HOST]’;

-- mysql -u davenportdd_modx -pSHJlY815pAHYWMSi
-- SHOW GRANTS FOR 'davenportdd_modx';
-- REVOKE ALL PRIVILEGES ON davenportdd_modx.* FROM 'davenportdd_modx'@'localhost';
-- FLUSH PRIVILEGES;
-- mysql --user="$user" --password="$password" --database="$database" --execute="DROP DATABASE $user; CREATE DATABASE $database;"
-- 
-- mysql --user='davenportdd_modx' --password='SHJlY815pAHYWMSi' --database='davenportdd_modx' --execute='REVOKE ALL PRIVILEGES ON davenportdd_modx.* FROM 'davenportdd_modx'; 
mysql --user='davenportdd_modx' --password='SHJlY815pAHYWMSi' --database='davenportdd_modx' --execute='REVOKE DELETE PRIVILEGES ON davenportdd_modx.* FROM 'davenportdd_modx';

mysql -uroot -p5f21fe10aa5e3047ef70c26506320d40 -e "REVOKE DELETE ON davenportdd_modx.* FROM 'davenportdd_modx';"
mysql -uroot -p5f21fe10aa5e3047ef70c26506320d40 -e "SHOW GRANTS FOR 'davenportdd_modx';"


-- Lock down
mysql -uroot -p5f21fe10aa5e3047ef70c26506320d40 -e "REVOKE ALL PRIVILEGES ON davenportdd_modx.* FROM 'davenportdd_modx';"
mysql -uroot -p5f21fe10aa5e3047ef70c26506320d40 -e "GRANT SELECT, UPDATE ON davenportdd_modx.* TO 'davenportdd_modx';"

-- Unlock
mysql -uroot -p5f21fe10aa5e3047ef70c26506320d40 -e "GRANT SELECT, INSERT, UPDATE, DELETE, INDEX, EXECUTE ON davenportdd_modx.* TO 'davenportdd_modx';"
mysql -uroot -p5f21fe10aa5e3047ef70c26506320d40 -e "GRANT ALL ON davenportdd_modx.* TO 'davenportdd_modx';"

mysql -uroot -p5f21fe10aa5e3047ef70c26506320d40 -e "GRANT ALL ON davenportdds_wp.* TO 'davenportdds_wp';"


CREATE USER 'sp'@'localhost' IDENTIFIED BY 'white-chocolate-mocha=16OZ';
GRANT ALL PRIVILEGES ON *.* TO 'sp'@'localhost' WITH GRANT OPTION;


CREATE USER 'sp'@'%' IDENTIFIED BY 'white-chocolate-mocha=16OZ';
GRANT ALL PRIVILEGES ON *.* TO 'sp'@'%' WITH GRANT OPTION;

mysql -usp -pwhite-chocolate-mocha=16OZ
SHOW GRANTS FOR 'davenportdd_modx';


mysql -uemcendo_modx -pJpkAtTMAs8gnCxC5 --database=emcendo_modx -e "update modx_site_snippets set MemberCheck = replace(MemberCheck, 'function getInstance(', 'static function  getInstance(');"
mysql -uemcendo_modx -pJpkAtTMAs8gnCxC5 --database=emcendo_modx -e "update modx_site_snippets set snippet = replace(snippet, 'function getInstance(', 'static function  getInstance(');"
mysql -uemcendo_modx -pJpkAtTMAs8gnCxC5 --database=emcendo_modx -e "SHOW COLUMNS FROM modx_site_snippets;"

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, 'find this string', 'replace found string with this string');

mysql -uemcendo_modx -pJpkAtTMAs8gnCxC5 --database=emcendo_modx -e "update modx_site_snippets set snippet = replace(snippet, 'function getInstance(', 'static function  getInstance(');"
mysql -uemcendo_modx -pJpkAtTMAs8gnCxC5 --database=emcendo_modx -e "SELECT * FROM 'emcendo_modx' WHERE INSTR('snippet', 'unction getInstance(') > 0;"

以上是关于sql 随机收集mysql语句的主要内容,如果未能解决你的问题,请参考以下文章

mysql 分组后 每组随机取一条记录 求sql语句

Mysql sql语句技巧与优化

使用sql语句在mysql的表中随机获取数据

mysql慢查询

SQL语句如何实现从数据库表中查询随机数据的记录

MYSQL数据库里面的字段怎么随机替换字符