帝范

李世民

帝范序

朕闻大德曰生,大宝曰位。辨其上下,树之君臣,所以抚育黎元,钧陶庶类,自非克明克哲,允武允文,皇天眷命,历数在躬,安可以滥握灵图,叨临神器!是以翠妫荐唐尧之德,元圭赐夏禹之功。丹字呈祥,周开八百之祚;素灵表瑞,汉启重世之基。由此观之,帝王之业,非可以力争者矣

继续阅读“帝范”

删除 Mac OS X 中“打开方式”里重复或无用的程序列表

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user;killall Finder;echo “Open With has been rebuilt, Finder will relaunch

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system-domainuser;

mysql重置root密码

英文原文参考地址

1、检查版本
mysql –version
MySQL output

mysql Ver 14.14 Distrib 5.7.16, for Linux (x86_64) using EditLine wrapper
Or output like this for MariaDB:

MariaDB output
mysql Ver 15.1 Distrib 5.5.52-MariaDB, for Linux (x86_64) using readline 5.1

2、停止服务

MySQL with:
sudosystemctl stop mysql

MariaDB wtih:
sudosystemctl stop mariadb

3、开启安全模式
sudo mysqld_safe –skip-grant-tables –skip-networking &

4、使用root免密码登录
mysql -uroot

MySQL prompt
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>
MariaDB prompt
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]>

5、FLUSH PRIVILEGES;
非常关键,必须先执行这个,然后执行后面的语句才有效

6、修改密码
For MySQL 5.7.6 and newer as well as MariaDB 10.1.20 and newer, use the following command.

ALTER USER’root’@’localhost’IDENTIFIED BY ‘new_password’;

For MySQL 5.7.5 and older as well as MariaDB 10.1.20 and older, use:

SET PASSWORD FOR ‘root’@’localhost’=PASSWORD(‘new_password’);

或者
UPDATE mysql.user SET authentication_string =PASSWORD(‘new_password’)WHERE User =’root’AND Host =’localhost’;

7、重启
For MySQL, use:
sudokillcat/var/run/mysqld/mysqld.pid

For MariaDB, use:
sudokill/var/run/mariadb/mariadb.pid

Then, restart the service using systemctl.

For MySQL, use:
sudo systemctl start mysql

For MariaDB, use:
sudo systemctl start mariadb

MACOS下升级MySQL数据库

1. 官网下载新版本的MySQL

2.在设置中关闭MySQL数据库

3.安装数据库,安装好之后打开利用Spotlight打开/usr/local文件夹,就会看到两个版本的mysql数据库,这两个文件中都有data,还有mysql指针这个文件夹

4.首先将新版本中的data文件夹重命名为dataold,

sudo mv 新版本路径/data  新版本路径/dataold

5.将老版本中的data文件夹复制到新版本中

sudo cp -rf  老版本路径/data   新版本路径

6.然后设置正确的权限

sudo chown -R  _mysql /usr/local/mysql-5.7.19-osx10.12-x86_64/data //后面跟的是新版本中data的路径

7.启动Mysql 修复数据库

sudo /usr/local/mysql/support-files/mysql.server start

8.运行升级程序

/usr/local/mysql/bin/mysql_upgrade -u username -p

//输入你原来数据库的用户名和密码 ,如果先前设置了环境变量直接输入mysql_upgrade 即可,别忘了用户名和密码

9.重启mysql数据库

sudo /usr/local/mysql/support-files/mysql.server restart

10.查看版本号

mysql -u username -p

mysql授权多个IP

以123.123.123.123 、123.123.123.124两个IP地址的用户访问db1为例,分别创建用户名user1、user2

1、为123.123.123.123上创建用户user1

create user ‘user1’@’123.123.123.123’ IDENTIFIED BY ‘XXXXXXX’;

grant select on db1.table1 to ‘user1’@’123.123.123.123’ ;

2、为123.123.123.124上创建用户user2

create user ‘user2’@’123.123.123.124’ IDENTIFIED BY ‘YYYYY’;

grant select on db1.table1 to ‘user2’@’123.123.123.124’ ;

说明:用户是按IP区分的,不同IP用户名可以相同

wordpress忘记用户登录密码

参考地址 https://wordpress.org/documentation/article/reset-your-password/
1、登录数据库,找到users结尾的表,如wp_users
2、使用新密码生成MD5 hash 在线生成工具 https://www.miraclesalad.com/webtools/md5.php
或者通过下面的命令生成
python

import hashlib
m = hashlib.md5()
m.update(b’123′)
m.hexdigest()
‘202cb962ac59075b964b07152d234b70’

On Unix/Linux:
  1. Create a file called wp.txt, containing nothing but the new password.
  2. tr -d ‘\r\n’ < wp.txt | md5sum | tr -d ‘ -‘
  3. rm wp.txt
On Mac OS X:
  1. Create a file called wp.txt, containing nothing but the new password. Then enter either of the lines below
  2. md5 -q ./wp.txt; rm ./wp.txt (If you want the MD5 hash printed out.)
3. md5 -q ./wp.txt | pbcopy; rm ./wp.txt (If you want the MD5 hash copied to the clipboard.)
3 、修改表
update wp_users set user_pass='md5 hash' where id=1;--改成你的id

WordPress 通过nginx代理后跳转127.0.0.1

由于配置了nginx代理后,系统会自动跳转127.0.0.1,导致无法登录,无法通过页面进行修改域名配置。此时可以通过数据库进行直接修改。

登录数据库,找的wp_options表

修改

MariaDB > select * from wp_options where option_name=’home’ or option_name=’siteurl’;

option_idoption_nameoption_valueautoload
2siteurlhttps://abc.com on
3homehttps://abc.com on

修改option_value 为域名即可。

腾讯云图