MySQL 8.0 误删了root用户折腾记

背景:最新想尝鲜安装下ubuntu 20.04,默认mysql版本为8.0,一不小心把root用户给删除了,开始折腾。 一、修改配置文件 在配置文件/etc/mysql/conf.d/mysql.cnf中增加2行 skip-grant-tables 重启mysql服务: sudo systemctl restart mysql.service 登录mysql,分别执行以下几行code use mysql; insert into user(User,authentication_string,ssl_cipher,x509_issuer,x509_subject) values('root','','','',''); update user set Host='localhost',select_priv='y', insert_priv='y',update_priv='y',Alter_priv='y',delete_priv='y',create_priv='y',drop_priv='y',reload_priv='y',shutdown_priv='y',Process_priv='y',file_priv='y',grant_priv='y',References_priv='y',index_priv='y',create_user_priv='y',show_db_priv='y',super_priv='y',create_tmp_table_priv='y',Lock_tables_priv='y',execute_priv='y',repl_slave_priv='y',repl_client_priv='y',create_view_priv='y',show_view_priv='y',create_routine_priv='y',alter_routine_priv='y',create_user_priv='y' where user='root';commit; 二、修改配置为正常再修改root密码 将密码修改成root@12345 mysql use mysql; alter user 'root'@'localhost' identified with mysql_native_password by 'root@12345';
阅读全文

给apt源添加代理

设置代理 sudo vim /etc/apt/apt.conf 加上下面一行代码: Acquire::http::proxy "http://127.0.0.1:8123"; Acquire::https::proxy "https://127.0.0.1:8123"; Acquire::socks::proxy "socks://127.0.0.1:1080";
阅读全文

Ubuntu 18.04 下解决 shadowsocks 服务报错问题

1. 报错内容 启动时报错如下: Traceback (most recent call last): File "/usr/local/bin/sslocal", line 11, in sys.exit(main()) File "/usr/local/lib/python3.6/dist-packages/shadowsocks/local.py", line 39, in main config = shell.get_config(True) File "/usr/local/lib/python3.6/dist-packages/shadowsocks/shell.py", line 262, in get_config check_config(config, is_local) File "/usr/local/lib/python3.6/dist-packages/shadowsocks/shell.py", line 124, in check_config encrypt.try_cipher(config, config) File "/usr/local/lib/python3.6/dist-packages/shadowsocks/encrypt.py", line 44, in try_cipher Encryptor(key, method) File "/usr/local/lib/python3.6/dist-packages/shadowsocks/encrypt.py", line 83, in init random_string(self._method_info)) File "/usr/local/lib/python3.6/dist-packages/shadowsocks/encrypt.py", line 109, in get_cipher return m(method, key, iv, op) File "/usr/local/lib/python3.6/dist-packages/shadowsocks/crypto/openssl.py", line 76, in init load_openssl() File "/usr/local/lib/python3.6/dist-packages/shadowsocks/crypto/openssl.py", line 52, in load_openssl libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,) File "/usr/lib/python3.6/ctypes/init.py", line 361, in getattr func = self.getitem(name) File "/usr/lib/python3.6/ctypes/init.py", line 366, in getitem func = self._FuncPtr((name_or_ordinal, self))...
阅读全文
VIM

CentOS 6 64位系统中编译安装vim8

VIM8发布也很长一段时间了,目前基本趋于稳定,刚好最近也在学习go,对于go的语法支持插件需要vim8,而我用的CentOS 6中VIM版本为7.4,果断开始折腾。 1、下载vim8源码 mkdir /opt/vim8 cd /opt/vim8 git clone https://github.com/vim/vim.git 2、编译vim8 废话不多说,看操作: cd /opt/vim8/vim # 需要python3的支持,这里我们安装epel源,同时安装python34和ruby开发包 yum install epel-release -y yum install python34 python34-devel # 开始编译vim ./configure --prefix=/usr/local/vim8 \ --with-features=huge \ --enable-multibyte \ --enable-rubyinterp=yes \ --enable-pythoninterp=yes \ --with-python-config-dir=/usr/lib64/python2.6/config \ --enable-python3interp=yes \ --with-python3-config-dir=/usr/lib64/python3.4/config-3.4m \ --enable-luainterp=yes \ --enable-gui=gtk2 \ --with-ruby-command=$(which ruby) \ --enable-cscope # 编译 make # 安装 make install 3、配置8 治病还是得看操作: # 添加环境变量至/etc/profile,最后一行添加 export PATH=/usr/local/vim8/bin:$PATH # 安装vundle.vim插件,用于安装go插件 git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim 添加~/.vimrc文件,内容如下: syntax on set nu "set nocompatible " be iMproved, required filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() "...
阅读全文