Ubuntu 管理心得

搜尋此網誌

2020年2月28日 星期五

replace xz with 7z with password

#!/bin/bash

for i in /BACKUP/kpchiao9600k/20200225_Ubuntu_18.04.4_LTS/*; do
    xzcat $i | 7z a -mx=9 -mmt=4 -p -si "$(basename "$i" .tar.xz)_pwd_bsun.tar.7z"
done
#
# Decompress with the following command followed by the password.
#   7z x -so boot_efi_2020_02_25_pwd_bsun.tar.7z | tar tvf -
# Just key in the password, no prompt will be shown.

2020年2月27日 星期四

setup permission for mysqldump


  1. Create ~/.my.cnf, add these lines:
    [mysqldump]
    user=student
    password=student
    chmod 0600 ~/.my.cnf
  2. Inside phpmyadmin, set 'Select' and 'LOCK TABLES' permission to database 'drupal' for 'student' as the following image:


  3. Then, dump drupal with the command without username and password:
     mysqldump drupal > kpchiao9600k_drupal.sql
    or
     mysqldump -B drupal > kpchiao9600k_drupal.sql
    The -B option will add the create database and use datatebase lines into dump file as:
    CREATE DATABASE /*!32312 IF NOT EXISTS*/ `drupal` /*!40100 DEFAULT CHARACTER SET latin1 */;

    USE `drupal`;





2020年2月14日 星期五

2020年2月12日 星期三

Install nvidia driver ubuntu

  1. ubuntu-drivers devices
    e.g. nvidia-driver-435 - distro non-free recommended
  2. sudo ubuntu-drivers autoinstall or

    sudo ubuntu-drivers nvidia-driver-435 

  3. reboot 

2020年2月9日 星期日

mysql installation on ubuntu 18.04

  1. sudo apt update
  2. sudo apt install mysql-server
  3. sudo mysql_secure_installation
  4. sudo mysql, then issue the command: SELECT user,authentication_string,plugin,host FROM mysql.user;
Originally, the root user is authenticated with the "auth_socket" plugin.
To configure the root account to authenticate with a password,
run the following ALTER USER command.
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
 
Replacing the 'password' with a new strong password. 
Note that this command will change the root password you set in Step 2. 

網誌存檔