Linux Study Notes

Source: Internet
Author: User

Linux directory

Etc:It is generally used to store the configuration file of the entire file system required by the program. As for why to store the configuration file under/etc, according to the original UNIX statement, the following is a pile of fragmented things called etc, which is actually a legacy of history.

Usr:Generally, it is similar to the 'Program files' folder in Windows, that is, the installation directory of the program.

Var:Generally, files that change frequently are stored. For example, mysql databases are stored in the/var/lib/mysql folder.

 

View help

Man rpm

Rpm -- help or rpm -?

 

Modify IP Address

Vi/etc/sysconfig/network-scripts/ifcfg-eth0, and then find the ipaddr item to modify

The ifcfg-eth0 content is as follows:

DEVICE = eth0

TYPE = Ethernet

UUID = 7179f765-6093-43a3-be5b-20c012e05c6d

ONBOOT = yes

NM_CONTROLLED = yes

BOOTPROTO = none

HWADDR = 00: 0C: 29: 5F: 06: 46

IPADDR = 192.168.1.12

PREFIX = 24

GATEWAY = 192.168.1.1

DNS1 = 192.168.1.1

DEFROUTE = yes

20174_failure_fatal = yes

IPV6INIT = no

NAME = "System eth0"

 

 

Find command

Find a directory: find/etc-name * ifcfg-eth0 *

Find the current directory: find.-name abc

Find-name abc

 

Chkconfig command

Format: chkconfig -- level 35 sshd on

Level 0: Shutdown

Level 1: Single User Mode

Level 2: multi-user command line mode without network connection

Level 3: multi-user command line mode with network connection

Level 4: unavailable

Level 5: multi-user mode with graphic interface

Level 6: restart

 

 

 

Yum command

Install yum install abc

Yum remove abc uninstall

 

Rpm command

Rpm-qa | grep-I query programs that contain the keyword "mysql" in programs that have already been installed in mysql.-I is case-insensitive.

 

Install the RPM package

Rpm-ivh abc. rpm

-I install

-V: displays the installation process information.

-H: # used to display the installation progress

 

Uninstall installed software

Rpm-e abc

-E cannot have a suffix. rpm

Rpm-e -- nodeps abc

-- Nodeps: Uninstall a program that has a dependency (dependencies) relationship. For example, before installing mysql in centos, you must first uninstall the original mysql-lib package. Otherwise, a conflict occurs ).

 

Upgrade PM package

Rpm-Uvh abc. rpm

-U update

 

Query RPM packages (installed)

Rpm-q * abc. rpm

-Q: q is required for queries.

-L Query files contained in software packages installed

-I: query the installed software package details.

-A: Query all installed software packages.

 

Query RPM packages (not installed)

Rpm-qp * abc. rpm

-Q: q is required for queries.

-P pageage: Query Information about uninstalled software packages.

-L Query files contained in software packages installed

-I: query the installed software package details.

-A: Query all installed software packages.

 

MySQL Section========================================================== ======================

Install MySQL

1) Step 1: rpm-ivh MySQL-client-5.6.11-2.el6.i686.rpm MySQL-server-5.6.11-2.el6.i686.rpm

In the above sentence, although the client is placed in front of the server, the server is installed first. After all, there is no server, and what is the connection between the client and the client?

After the installation is complete, the following information will appear:

A random password has been set for the MySQL root USER!

You will find that password in '/root/. mysql_secret '.

 

You must change that password on your first connect,

No other statement but 'set password' will be accepted.

See the manual for the semantics of the 'password expired' flag.

 

Also, the account for the anonymous user has been removed.

 

In addition, you can run:

 

/Usr/bin/mysql_secure_installation

 

Which will also give you the option of removing the test database.

This is stronugly recommended for production servers.

 

See the manual for more instructions.

 

Please report any problems with the/usr/bin/mysqlbug script!

 

The latest information about MySQL is available on the web

 

Http://www.mysql.com

 

Support MySQL by buying support/licenses at http://shop.mysql.com

 

New default config file was created as/usr/my. cnf and

Will be used by default by the server when you start it.

You may edit this file to change server settings

It indicates that MySQL is successfully installed! But no command is accepted. Unless you SET the PASSWORD first, the default PASSWORD is put in '/root/. mysql_secret '.

 

2) Step 2: Set the password

So we went to the directory '/root' to find the file. When we input ll or ls, we found that the file could not be found, because in linux, We have clicked '. 'All files starting with 'are hidden files, so we can see '. mysql_secret 'file. You can view the password in the vi file, or enter the content of the cat file.

 

After we get the password,

First, you can start mysql,/etc/init. d/mysql start, or service mysql start.

Enter mysql-u root-p, and press enter to prompt us to enter the password, that is, the password we just entered, if the prefix of linux commands is changed to 'mysql> ', the logon is successful!

 

In the next step, modify the password and enter set password = PASSWORD ('abc') as follows: (you can also set password = password ('abc'); Do not forget the semicolon. )

Mysql>Set password = password ('abc ');

When Query OK and 0 rows affected (0.10 sec) are displayed, the password is changed to abc! For example

Then enter exit/quit to exit MySQL.

 

3) Step 3: Initialize MySQL

Next to the previous step, after exiting MySQL, enter/usr/bin/mysql_secure_installation, and then ask you for the database password. Enter the password, otherwise you will not be allowed to continue setting, then, I asked you if you needed to change the root password. We just set it, so you don't have to enter n. You can press enter for the rest of the lines. You need to know that in this setting, press ENTER = Y, but you can

Not necessarily. Remember!

 

 

Uninstall MySQL

(1) rpm-e MySQL-server-5.6.11-2.el6.i686 MySQL-client-5.6.11-2.el6.i686

Many people think that MySQL has been successfully deleted after completing the first step. If you reinstall MySQL again, they will find that there is no prompt after installing MySQL, and you are not required to change the password.

For example:

This indicates that MySQL is not deleted.

 

2) Find the residual MySQL File

Use the Find command: find/-name mysql

The returned results are as follows:

 

That is to say, we still have three parts not deleted, and the second folder belongs to the first folder, so we only need to delete the first/var/lib/mysql, third,/usr/lib/mysql and/usr/my. cnf is enough, so:

Rm-Rrf/var/lib/mysql

Rm-Rrf/usr/lib/mysql

Rm-rf/usr/my. cnf(The configuration file remains unchanged. You can delete the configuration file without affecting the next installation)

Try again by installation. Is there a prompt to change the password? In fact, please analyze it carefully, because the database has been established during the first installation, and the password or something will definitely be saved, however, when you uninstall MySQL, the database will be retained for security reasons. Of course, the password set last time will be retained. In fact, you only need to delete/var/lib/mysql, try again and you will be prompted to change the password.

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.