Mounting discs
Mkdir/mnt/cdrom
#建立挂载点
mount/dev/cdrom/mnt/cdrom/
#挂载光盘
To replace the Yum Source:
cd/etc/yum.repos.d/
Invalidating the network Yum source
MV Centos-base.repo Centos-base.repo.bak
Replace disc as Yum source
VI Centos-media.repo
# Yum list to see if the modification was successful (the third column is the source name)
Replace 163 source
Reference website http://mirrors.163.com/.help/centos.html
Mv/etc/yum.repos.d/centos-base.repo/etc/yum.repos.d/centos-base.repo.backup
Download the corresponding version of the repo file, put in the/etc/yum.repos.d/(please do the appropriate backup before the operation)
Http://mirrors.163.com/.help/CentOS7-Base-163.repo
Replace original Centos7-base-163.repo
Yum Clean All
Yum Makecache
System minimum installation generally does not install wget
Requires Yum install wget
WIN10 Xshell Unable to connect problem
Win10 Ping Linux can ping through.
Linux cannot ping Linux.
Workaround Close the WIN10 firewall or enable
After installing CentOS, you cannot enter Chinese.
Workaround settings, input source, add Chinese, default shortcut key Super+space
Yum Some software prompts are this OK [y/d/n]
Explain
y = yes
n = No
d = Download Only
Yum command occurs when Yum is locked (installs Ubuntu)
FIX: # rm-f/var/run/yum.pid
Install MySQL method one
Since it is recommended to replace MySQL with mariadb from Rhel 7, there is no installation package for MySQL by default, that is, there is no way to install MySQL software directly using the Yum command. In order to install MySQL, I chose to go to the official website http://dev.mysql.com/downloads/repo/yum/Download the installation package, but I need to register before downloading. Because the CentOS 7 system was used, I downloaded the mysql-community-release-el7-5.noarch.rpm file. After downloading it, place it in the/root directory and use the command:
[Email protected] ~]# yum localinstall mysql-community-release-el7-5.noarch.rpm
Use this command to add MySQL Yum repository to the system's software Library list (repositorylist). You can then use the following command to check if the add was successful:
[Email protected] ~]# Yum repolist enabled | grep mysql
Then, install MySQL using the following command:
[Email protected] ~]# yum install mysql-community-server
As shown, this command installs MySQL server, which comes with a number of support software, including software such as MySQL client, shared client library (MYSQL-COMMUNITY-LIBS), and so on. Note that the MySQL version installed here is 5.6 version.
When the installation is complete, start the MYSQLD service and set it to boot:
[Email protected] ~]# systemctl start mysqld
[Email protected] ~]# systemctl enable mysqld
Then, check the MYSQLD service status:
[Email protected] ~]# systemctl status mysqld
To view the MYSQLD service listening port:
[Email protected] ~]# NETSTAT-ATULPN | grep mysqld
As shown, MySQL listens on TCP port 3306. However, because the firewall does not pass the port, the MySQL database on the server cannot be accessed from other devices. But because MySQL here is also only available to the native PHP use, so there is no need to put the TCP port 3306.
According to the official MySQL manual, it is recommended to use the following command to enhance the security of the database after installing the MySQL database:
[Email protected] ~]# mysql_secure_installation
This command program can assist you to set the password of the database root account, remove the anonymous user account, allow remote login to the root account, remove the test database, and finally ask if you want to reload the privileged table for the changes to take effect. I set the database root account password, the others are (Y).
If you do not want to use the above command, then you can use the following command to set the root account password, enter after it will prompt you to enter the password:
[Email protected] ~]# mysqladmin-u root password
If you want to modify the root account password, you can use the following command, enter, it will prompt you to enter the password, and then set a new password:
[Email protected] ~]# mysqladmin-u root-p password
Use the root account to enter the MySQL admin background, it will prompt you to enter the password:
[Email protected] ~]# mysql-u root –p
To create a local user:
mysql> Create user ' username ' @ ' localhost ' identified by ' password ';
To create a new database:
mysql> Create database name ;
Grant all permissions for the specified database to the specified user:
Mysql> Grant all privileges the on database name. * to ' username ' @ ' localhost ';
To refresh the System permissions table:
Mysql> flush Privileges;
Enter the MySQL database (System comes with) and query for the presence of the specified user (indicating presence if there is a heap of things):
mysql> use mysql;
Mysql> SELECT * from user where user = ' user name ';
If you want to delete a local user, use:
mysql> drop user ' username ' @ ' localhost ';
If you want to delete a database, use:
mysql> Drop database name ;
To view the existing database:
Mysql> show databases;
Exit MySQL admin background:
Mysql> Exit
Here's what you actually do:
[Email protected] ~]# mysql-u root-p
Enter Password:
mysql> create user ' myuser ' @ ' localhost ' identified by ' 1234 '; New local user myuser with a password of 1234
mysql> CREATE DATABASE MyDB; New Database MyDB
Mysql> grant all privileges on mydb.*to [email protected]; Authorizes all permissions for the database mydb to the local user MyUser
mysql> flush Privileges; Refresh System Permissions Table
mysql> use MySQL; Enter the database MySQL (this database is the system comes with)
Mysql> SELECT * from user where user = ' myuser '; Querying the database for the presence of user myuser in MySQL
mysql> show databases; Show all existing Databases
Mysql> exit
Set up above, you can use myuser this account login MySQL, and can find that the user has a database mydb.
For MySQL, you also need to know:
/etc/my.cnf: This is the MySQL configuration file. However, because I still do not play MySQL, so I do not move it temporarily.
/var/lib/mysql: This is the actual database storage directory. There is no doubt that it cannot be deleted, and, to be aware, give enough capacity to the partition in which it resides.
/var/log/mysqld.log: This is the MySQL error log file.
Method Two
1.rpm-qa | grep MySQL
2. Uninstall the above installed package
rpm-e **msyql**
Force Uninstall, add--nodeps
Example: Rpm-e--nodeps akonadi-mysql
3 Rpm-qa | grep mariadb
#列出所有被安装的rpm Package
4. Remove all packages listed in the third step
Mysql-sever files in the 5.CentOS 7 yum source that do not appear to be installing MySQL properly
6.# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# RPM-IVH. rpm
# yum Install Mysql-community-server
Restart MySQL service after successful installation
# Service Mysqld Restart
The initial installation of MySQL is a root account without a password
Set Password 123456
# Mysql-uroot
mysql> set password for ' root ' @ ' localhost ' = password (' 123456 ');
Mysql> exit
Start the MySQL client mysql-uroot-p
Basic Linux Acrobatics