Delete a NVROM entry[reference]

June 28, 2019 分类:Linux

The EFI version 2 shell provides a command called bcfg that can do the job. You'd need to do bcfg boot dump -b to see the entries, then bcfg boot rm # to delete entry number # -- # must be the number associated with whatever entry you want to remove.

In Linux, efibootmgr can do the job: Type efibootmgr or efibootmgr -v to see the entries, then do efibootmgr -b # -B to delete entry #. (You must type these commands as root or using sudo.)

In Windows, the EasyUEFI tool should be able to handle the job, although I've only toyed with it briefly, so I can't give detailed instructions.

Fixed my corrupt database last night

March 3, 2019 分类:树莓派,Linux

For some reason, I turned off the power switch last night, before I did it, I forgot to shut down my home servers correctly. Then, it was not a surprise the database on one of my Raspi crashed. I've been encountered this issue last time.
In order to solve this problem, Follow the hint, use "journalctl -xe" command to show related information. Modify "my.cnf", add " innodb_force_recovery > 0 " then start the database, afterward comment the " innodb_force_recovery > 0" line in again, restart the database subsequently. Done.

Use a SMB directory on Apache2

February 23, 2019 分类:树莓派,Linux

Install samba client:

apt-get install  samba-common smbclient samba-common-bin smbclient  cifs-utils

mkdir /mnt/abc
mount -t cifs //yourIP/yourShare /mnt/abc

If you need to add credentials at the mount time:

mount -t cifs //server/share /mnt/abc -o user=user,pass=password,dom=domain

If you want to dismount the share later:

umount /mnt/abc

Mount permanently:

sudo nano /etc/fstab

Add: //server/share /mnt/abc cifs guest,uid=1000,iocharset=utf8,x-systemd.automount 0 0

For more information visit: forum

Access Permission(May not necessary):

chown -R $USER:$USER /mnt/abc
chmod -R 755 /mnt/abc

Apache2 on Debian based OS:

Modify apache2.conf add lines:

<Directory /mnt/abc/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted


Modify conf in sites-available directory:

    <VirtualHost *:80>
DocumentRoot /mnt/abc
ErrorLog logs/myvhost-error_log
CustomLog logs/myvhost-access_log combined
ServerAdmin [email protected]
<Directory /mnt/abc/>
    AllowOverride All
    Options +Indexes


November 3, 2016 分类:Linux

$ sudo fdisk -u -l
$ dd bs=512 count=[fdisk命令中最大的end数+1] if=/dev/sda6 of=/sysbackup.img
$ dd if=sysbackup.img of=/dev/sda
$ dd bs=512 count=[fdisk命令中最大的end数+1] if=/dev/sda6 | gzip -6 > /sysbackup.img.gz
$ gzip -dc /sysbackup.img.gz | dd of=/dev/sda

最好先umount所有 if和of 设备的分区。后执行sudo sync。

如果对整个硬盘进行备份和恢复 count=[fdisk命令中最大的end数+1] bs=512可以去掉。

当你刚装完redhat 7.3第一次启动时,总会死掉。主要原因是Linux在安装时探测到有usb-uhci和ehci-hcd两个控制器,但在启动时,加载完usb-uhci再加载ehci-hcd就会有冲突。分析认为redhat7.3系统内核在支持USB2.0标准上存在问题。在其他版本的Linux中均不存在此问题。

mount -o remount,rw / 使/ 可写,init直接启动的系统默认只mount /为只读
然后vi /etc/modules.config文件(modules.conf)
删除alias usb-controller1 ehci-hcd一行。或前面加#注释掉
然后mount -o remount,ro / 使/ 只读,避免直接关机破坏文件系统

  1. .tar格式

解包: tar -xvf FileName.tar
打包: tar -cvf FileName.tar DirName(注:tar是打包,不是压缩)

  1. .gz格式

解压1:gunzip FileName.gz
解压2:gzip -d FileName.gz
压缩:gzip FileName

  1. .tar.gz格式

解压: tar -zxvf FileName.tar.gz
压缩: tar -zcvf Filename.tar.gz DirName

  1. .bz2格式

解压1: bzip2 -d filename.bz2
解压2: bunzip2 filename.bz2
压缩: bzip2 -z filename

  1. .tar.bz2格式

解压: tar -jxvf filename.tar.bz2
压缩: tar -jcvf filename.tar.bz2 dirname

  1. .bz格式

解压1: bzip2 -d
解压2: bunzip2

  1. .tar.bz格式

解压:tar -jxvf

  1. .Z格式

解压: uncompress filename.Z
压缩:compress filename

  1. .tar.Z格式

解压: tar -Zxvf filename.tar.Z
压缩: tar -Zcvf filename.tar.Z dirname

  1. .tgz格式

解压: tar -zxvf filename.tgz

  1. .tar.tgz格式

解压: tar -zxvf filename.tar.tgz
压缩: tar zcvf filename.tar.tgz filename

  1. .zip格式

解压: unzip
压缩: zip dirname

  1. .lha格式

解压: lha -e filename.lha
压缩: lha -a filename.lha filename

  1. .rar格式

解压: rar a filename.rar
压缩: rar e filename.rar


November 3, 2016 分类:Linux

Error: MySQL - mysqldump: Got error: 1016: Can't open file: './exampledb/xxx.frm' (errno: 24) when using LOCK TABLES
mysqldump -u root -pmysecretpassword --opt exampledb --lock-tables=false > exampledb.sql


/usr/local/mysql/bin/mysql -u root -p * myblog < /home/zhangy/blog/database_bak/myblog.sql

mysql -u dbadmin -p
use myblog;
set names utf8; #这里的字符集根你的将要导入的数据库的字符集一至。
source /home/zhangy/blog/database_bak/myblog.sql;

Table is marked as crashed and should be repaired
mysqlcheck --repair --all-databases


mysqladmin -u root -password ab12


mysqladmin -u root -p ab12 password djg345



mysql> UPDATE mysql.user SET password=PASSWORD(’新密码’) WHERE User=’root’;

mysql> SELECT USER();


drop命令格式:drop database <数据库名>;

例如,删除名为 xhkdb的数据库:
mysql> drop database xhkdb;

[例子1] 删除一个已经确定存在的数据库:
mysql> drop database drop_database;
Query OK, 0 rows affected (0.00 sec)

[例子2] 删除一个不确定存在的数据库:

mysql> drop database drop_database;
ERROR 1008 (HY000): Can't drop database 'drop_database'; database doesn't exist
// 发生错误,不能删除'drop_database'数据库,该数据库不存在。

mysql> drop database if exists drop_database;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> create database drop_database;  // 创建一个数据库
Query OK, 1 row affected (0.00 sec)
mysql> drop database if exists drop_database;  // if exists 判断数据库是否存在,不存在也不产生错误
Query OK, 0 rows affected (0.00 sec)

centos 5 安装低版本的mysql 4.0 config报错 Linux thread not found

解决方法 打开文件:

/ Linuxthreads /

老外:You need to install glibc-devel glibc-headers package
yum install glibc-devel glibc-headers

Also, linuxthreads is obsoleted and posixthreads should be used instead. You should look at mysql's configure options to switch to pthreads.