Chinaunix首页 | 论坛 | 博客
  • 博客访问: 267580
  • 博文数量: 44
  • 博客积分: 1431
  • 博客等级: 上尉
  • 技术积分: 558
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-24 12:53
文章分类
文章存档

2012年(1)

2011年(28)

2010年(15)

分类: LINUX

2010-12-24 14:03:38

1. how to mount nfs
   If you get two linux machines,one is server wich ip 192.168.1.250,the other is client with ip 
   192.168.1.100; Now you wannt share some data in 192.168.1.250 so that 192.168.1.100 can use them.   so, do the following steps:
   step1: vi /etc/exports  
   step2: add the following scripts in exports:/home/share *(rw,sync,no_root_squash), you will noticed that all shared directories.
   step3: log in 192.168.1.250 with root user, change to directory /etc/init.d, run command:
          service  nfs start
   step4: long in 192.168.1.100,run the following command: 
          mount -t nfs 192.168.1.250:/home/share /mnt/nfs
   step5: then you got it


2. How to use mysql in linux
 2.1 how to change root's password?
     After you deployed your mysql server,the default super user root didn't get a password,so, you      need change root's password; firstly, change to directory /usr/bin;Secondly, run command:./mysq     l_secure_installation,in the process, you can set a new password for root.
 2.2 how to login mysql server?
     mysql -u root -p    then enter password.
 2.3 how to create database?
     create database databasename character set utf8;
 2.4 how to run .sql script?
     login mysql server firstly
     use database;
     source /home/xxx.sql(where is your xxx.sql is located);

 2.5 How to fix the promble:ERROR: 1136 Column count doesn't match value count at row 1 when you are install MySQL rpm package.
    1. Uninstall the present rpm packages: rpm -v --erase  --nodeps XXX.rpm
    2. Delete /var/lib/mysql directory
    3. Reinstall MySQL*.rpm 
 2.6 How to make chinese character set work in MySQL?
     Once you had deploy your MySQL in linux, especially you deployed it with rpm packets,by default, your mysql will not display chinese character set, here is the way to fix it:
     Modify configure file named my.cnf located /etc/, add default-character-set=utf8 in [mysqld] section, also, add default-character-set=utf8 to [client] section if it didn't existed, just create it firstly. And another way is by run mysql commands as followed:
     mysql> set character_set_client=utf8;
     Query OK, 0 rows affected (0.00 sec)
     mysql> set character_set_connection=utf8;
     Query OK, 0 rows affected (0.00 sec)
     mysql> set character_set_database=utf8;
     Query OK, 0 rows affected (0.00 sec)
     mysql> set character_set_results=utf8;
     Query OK, 0 rows affected (0.00 sec)
     mysql> set character_set_server=utf8;
     Query OK, 0 rows affected (0.00 sec)
     mysql> set character_set_system=utf8;
     Query OK, 0 rows affected (0.01 sec)
     mysql> set collation_connection=utf8;
     Query OK, 0 rows affected (0.01 sec)
     mysql> set collation_database=utf8;
     Query OK, 0 rows affected (0.01 sec)
     mysql> set collation_server=utf8;
     Query OK, 0 rows affected (0.01 sec)
     After you finished, you can confirm it with the following steps:
     step1: mysql -u root -p
     step2: enter your password
     step3: SHOW VARIABLES LIKE 'character%'; show variables like 'collation_%';then you will find that mysql character set was set to utf8.




 2.7 How to fix the  promble:ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL server 
   This probmle cause by the remote connect privilege, by default, mysql didn't open remote connect. run the following commands:
   mysql>grant all PRIVILEGES on reservation .* to tester@'192.168.1.250' identified by '528629';
   mysql> flush privileges;
   here are some details about mysql remote priveleges:
    2.6.1 create remote login user and permissioned
    >grant all PRIVILEGES on  databasename .* to username@'a certained ip address' identified by 'password';
    >lush privileges;
    here are some tips about the command:
    all PRIVILEGES  means the user have all privileges,also,you can open some certained privilege to a user included select,insert,update,delete,create(should be separeted by ,),drop and so on.

    databasename.tablename  this paramater tells you that which databases and which tables should be privileged,according to the grammer,you can get that if you want to privileged all tabels of a database,then you should use database.*; and if you want to privileged all databases included all tables,you should use *.*

    username  this paramater means which user should be privileged,the user maybe a existed user, also,it can be a user didn't existed,in this situation,it username will be created at the sametime.

    a certained ip address  means the remote login ip,and if you don't care about the ip, then you can use "%"

    password  the password of the user

3. How to use ssh in Linux?
   ssh root@192.168.1.118(your server ip address)   then you are asked enter passwords of your username

4. How to monit your system resource status?
   ps -ef  or ps -aux
   mvstat(The memory use status)
   iostat -n 
   sar 
   top

5. How to backup your linux system?
   The following directories should be backed:
   /boot
   /etc
   /home
   /root
   /usr/local
   /var

6. How to use oracle 10g in linux?
   6.1 How to create a table in oracle 10g?
   CREATE TABLE "SYS"."PERSON" ( "PERSIONID" VARCHAR2(20) NOT NULL , "NAME" VARCHAR2(50), "PHONE" VARCHAR2(20)) TABLESPACE "TEST"

   6.2 How to delete database?
   drop tablespace tablespacename including contents and datafiles;

   6.3 When you run command 'dbstart', you get a error message that:ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener. this is because configure file dbstart located in $ORACLE_HOME/bin/ isn't set normally.
   change to directory $ORACLE_HOME/bin
   vi dbstart
   find string "ORACLE_HOME_LISTNER=$1", Then modify it as "$ORACLE_HOME"

   6.4 How to stop isqlplusctl emctl lstnctl database manually?
   Once you had started your oracle 10g database, if you want to stop it, you should do as the following descripted:
   #su - oracle(Attention: Not su oracle, why? I really don't know, maybe God know)
   #isqlplusctl stop
   #emctl stop dbconsole
   #lsnrctl stop
   #sqlplus / as sysdba
   #shutdown immediate
   #exit

   6.5 How to fix promble:cannot drop a user that is currently connected?
   execute the following steps:
   SQL>SELECT SID,SERIAL# FROM V$SESSION WHERE USERNAME='username';
   SQL>ALTER SYSTEM KILL SESSION'SID,SERIAL#';
   SQL>DROP USER username CASCADE;

   6.6 Sometimes when you run command: dbca, you will get an error message with details:Xlib: connection to ":0.0" refused by server. Then run the following command use root user, and rerun command: dbca with user oracle, then you will got it successfully.
   #xhost local:oracle non-network local connections being added to access control list

  
7. How to run jboss at the background in silence?
   run the following command:
   #nohup ./run.sh -c nh -b 0.0.0.0 &

8. How to use mount command?
   
   8.1 The followed commands demostrated how to mount cdrom:
   #mount -t iso9660 /dev/cdrom /mnt/cdrom
   8.2 The followed commands demostrated how to mount windows disk:
   #mount /dev/sda5 /mnt/D
   8.3 The followed commands demostrated how to unmount the partitions had mounted:
   #umount /dev/sda5

9. How to remote control windows system in linux?
   9.1 Install a software named rdesktop, once you had deploy it, use the following command:
   #rdesktop-vrdp -g 1024*768 -d 24 192.168.1.250
   9.2 If you want fullscreened the aim machine, you can use -f parameter, whicl looks like this:
   #rdesktip-vrdp -f ip  
   if you want to exit fullscreen, just use: Ctrl+Alt+Enter
   9.4 Also, you can use the following command:
   #rdesktop-vrdp -u username -p username's password -a 8/16/24 ip, once you run the command, inputting username and passwords is skiped.
   9.5 If you need more, go to

10. In the case of you had installed windows and linux on your machine, and your windows system had crashed for some unknown reasons or something like this situation, you want to reinstall windows system, in this situatiion, you can got it for you can't boot your machine from cdrom because the MBR of the hard disk was rewrited by your unix-like system in the process of installing your unix-like system. Maybe we can install windows without remove your unix-like system, but I had tried, and lost it. As a matter of fact, what I really want to do is remove the unix-like for rewriting MBR, and I got it use the following steps:
    step1: Log in your unix-like sytem(if you can)
    step2: run command:#fdisk /dev/hda   then type d, so you can choose which partition you want to delete.
    step3: repeat step2 untill all unix-like partition had delete.
    step4: #reboot
    step5: Install windows sytem noramlly

11. How to get your machine's hardware information?
    11.1 run command with root user: #dmidecode (Tool to analyse BIOS DMI data.)
    11.2 less /proc/cpuinfo   ; less /proc/meminfo

12. How to uncompress .cpio.gz files?
    #gunzip filename.cpio.gz
    #cpio -idmv < filename.cpio

13. How to mount iso?
   #mount -t iso9660 /fielname.iso /mnt/iso -o loop

阅读(2369) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~