CentOS Command Encyclopedia

Source: Internet
Author: User
system

# uname-a # View kernel/operating system/CPU information
# head-n 1/etc/issue # View operating system version
# cat/proc/cpuinfo # View CPU Information
# hostname # View computer name
# LSPCI-TV # list all PCI devices
# LSUSB-TV # list all USB devices
# lsmod # list the loaded kernel modules
# env # View Environment variables

Resources
# free-m                 # view memory usage and swap area usage
# df-h                   # view each partition usage
# du-sh < directory name >        # View the size of the specified directory
# grep memtotal/proc/meminfo   # View total Memory
# grep memfree/proc/meminfo     # View the amount of free memory
# uptime                  # View system run time, number of users, load
# cat/proc/loadavg      # View system load

Disks and Partitions
# Mount | column-t      # view attached partition status
# fdisk-l    & nbsp;          # View all Partitions
# swapon-s               # View all swap partitions
# hdparm-i/dev/hda      # View disk parameters (IDE devices only)
# DMESG | grep ide       # View IDE device detections at startup

Internet
# ifconfig # View properties of all network interfaces
# iptables-l # View firewall settings
# route-n # View the routing table
# netstat-lntp # View all listening ports
# netstat-antp # View all connections that have been established
# netstat-s # View Network statistics

Process
# ps-ef # View All Processes
# top # Real-time display of process status

User
# w # View active Users
# ID < user name > # view specified user information
# last # View User login log
# cut-d:-f1/etc/passwd # View All users of the system
# cut-d:-f1/etc/group # View all groups of the system
# crontab-l # View scheduled tasks for the current user

Service
# chkconfig--list # list all system services
# chkconfig--list | grep on # Lists all initiated system services

Program
# rpm-qa # View all installed Packages

1. Command installation: Yum install Mysql-server

2. Starting with: centos6.2 mysql5.1,root login (mysql-u root-p) without password;
System-> Management-> service, select Mysqld, set up boot and start service;

3. Related orders:
1 Start service: Services mysqld start
2) Modify password: MySQL
Execute the following statement after entering the MySQL command:
UPDATE mysql.user SET Password=password (' 123 ') WHERE user= ' root ';
Flush privileges;

3 Import SQL File command: source file path;

4 Enter the MySQL command: mysql-u user name-p, and then enter the password can enter the MySQL execution environment;

5 Export database or table: Mysqldump-u user name-P dataname>dataname.sql;

4.mysql Graphics Tool Workbench Installation:

1) Download address: http://www.mysql.com/downloads/workbench/#downloads
2) Select Oralce linux6, download mysql-workbench-gpl-5.2.37-1el6.i686.rpm
3) Yum Installation: Yum install RPM package name
Yum Uninstall: yum-y remove RPM Package name

shell> mysql-u root-p1234 MySQL

mysql> INSERT INTO User (Host,user,password) values (' localhost ', ' _backmysql ', ' databse ');
Add a MySQL user _backmysql from this computer, password: 1234
#mysql –u root–p
mysql>; GRANT FILE on *.* to backup@192.168.1.200 identified by ' 1234 ';
Mysql>;\exit
Open an account backup password 1234 gives access to file processing from ip:192.168.1.200
Format: Grant permission on database name. Table name user @ Login host identified by "User password";
Mysql>;grant Select,update,insert,delete on *.* to
atyu30@10.0.0.100
Identified by "1234";

1, Login into mysql,create a new user named "Xuys":
Format (MySql4.1.18):
GRANT [privilage] on [Database Name]. [Table Name] to [user name]@ [Server IP], identified by ' [user Password] ';

e.g.:
Grant Select,update,insert,delete on *.* xuys@ "192.168.88.234 identified by ' xuys1234 ';
GRANT all privileges on *.* to ml@ "%" identified by ' pass '

To view the result, Excute:
Use MySQL;
Select Host,user,password from user;

You can see that the Xuys user that you just created is already in the user table. The Host field represents the hosts that are logged on, their values can be IP, or the host name is available, and changing the value of the host field to% means that the Xuys user can log on to the MySQL server on any client machine, and it is recommended that you set it to% at development time.
Update user Set host = '% ' where user = ' Xuys ';


1: Use the show statement to find out what database is currently on the server:
Mysql> show DATABASES;
2:2. Create a database Mysqldata
mysql> CREATE DATABASE Mysqldata;
3: Select the database you created
mysql> use Mysqldata; (When the Enter key appears in the database changed, the operation is successful.) )
4: See what tables exist in the current database
Mysql> show TABLES;
5: Create a database table
Mysql> CREATE TABLE MYTABLE (name VARCHAR (), Sex CHAR (1));
6: Show the structure of the table:
Mysql> DESCRIBE MYTABLE;
7: Add a record to the table
mysql> INSERT INTO MYTABLE values ("HyQ", "M");
8: Load data into a database table (for example, d:/mysql.txt) in text mode
mysql> LOAD DATA Local INFILE "D:/mysql.txt" into TABLE MYTABLE;
9: Import. sql file command (e.g. D:/mysql.sql)
Mysql>use database;
Mysql>source D:/mysql.sql;
10: Delete Table
Mysql>drop TABLE MYTABLE;
11: Empty the table
Mysql>delete from MYTABLE;
12: Update the data in the table
Mysql>update MYTABLE set sex= "F" where name= ' HyQ ';

Here are some of the management experiences of using MySQL inadvertently seen on the web,
In Windows, MySQL exists as a service, and you should make sure that the service is started and that the available net start MySQL command is not started before you use it. Linux can be started with the "/etc/rc.d/init.d/mysqld start" command, and notice that the initiator should have administrator privileges.
The newly installed MySQL contains a root account with a blank password and an anonymous account, which is a great security risk, for some important applications we should improve security as far as possible, where the anonymous account deletion, the root account set the password, you can use the following command:
Use MySQL;
Delete from User where user= "";
Update User set Password=password (' NewPassword ') where user= ' root ';
If you want to limit the logon terminals used by the user, you can update the host field for the corresponding user in the users table, restart the database service after making the above changes, and at this point you may be able to log on to the following similar commands:
Mysql-uroot-p;
Mysql-uroot-pnewpassword;
MySQL mydb-uroot-p;
MySQL Mydb-uroot-pnewpassword;
The command parameters above are part of the common parameters, and the details refer to the documentation. The mydb here is the name of the database to log on to.
In the development and practical applications, users should not only use root to connect the database, although the use of root users to test is very convenient, but it will bring significant security risks to the system, but also not conducive to the improvement of management technology. We give the most appropriate database permissions to the users used in an application. A user who only inserts data should not be given permission to delete data. MySQL user management is implemented through the user table, there are two ways to add new users, one is to insert the corresponding data rows in the user table, set the appropriate permissions, and the second is to create a user with some kind of permission through the grant command. One of the common uses of grant is as follows:
Grant all on mydb.* to newusername@hostname identified by "password";
Grant usage on *.* to newusername@hostname identified by "password";
Grant Select,insert,update on mydb.* to newusername@hostname identified by "password";
Grant Update,delete on MyDB. TestTable to Newusername@hostname identified by "password";
To give this user the ability to manage his or her permissions on the object, add the WITH GRANT option after Grant. For users added with the Insert User table, the password field applies the password function to update the encryption, in case the malicious person steals the password. For those who have not used the user should be given clearance, permissions of the user should be timely recall permissions, recycling permissions can be updated by the user table corresponding fields, you can also use the revoke operation.
The following gives an explanation of the common rights that I get from other sources (www.cn-java.com):
Global Administrative permissions:
File: Read and write files on the MySQL server.
PROCESS: Displays or kills a service thread belonging to another user.
RELOAD: Overload access Control table, refresh log, etc.
SHUTDOWN: Turn off MySQL service.
Database/data Table/Data column permissions:
Alter: Modify existing data tables (for example, add/Remove Columns) and indexes.
Create: Create a new database or datasheet.
Delete: Deletes a table record.
Drop: Deletes a datasheet or database.
Index: Create or delete indexes.
INSERT: Adds a record of the table.
SELECT: Displays/searches the records of the table.
UPDATE: Modifies records that already exist in the table.
Special permissions:
All: Allow to do anything (like root).
USAGE: Only Allow login – nothing else is allowed.

CentOS Uninstall the original PHP operating environment published 423 days ago ⁄linux class ⁄ no comment

If the installation is CentOS full version, then already with the Apache and other components, we want to use KLOXO with the server components, you need to uninstall Apache, MySQL, PHP and other services.

Uninstall MySQL

# Rpm-qa | grep MySQL

# yum Remove MySQL

Uninstall Apache

# Rpm-qa | grep httpd

# yum Remove httpd

Uninstall PHP

# Rpm-qa | grep php

# Yum Remove php

Note: If the uninstall does not drop, the system will generally prompt the package dependencies, and list the name of the dependent package, first uninstall the hint-dependent package. If the uninstall does not drop, you can add the-nodeps parameter to force uninstall, such as uninstall php-5.2.6-11:

Rpm-e Php-5.2.6-11-nodeps
CentOS to see how many bits of their system are in 2010-10-17 6:09

[root@localhost ~]# uname-a
Linux localhost.localdomain 2.6.18-164.el5 #1 SMP Thu Sep 3 03:33:56 EDT 2009 i686 i686 i386 gnu/linux
[root@localhost ~]# getconf word_bit

[root@localhost ~] # echo $HOSTTYPE
i686
This is my machine, if it is 64 digits, the first and third command will show: x86_64

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.