first, installation landing
1. Install and turn on the service
Yum Install mariadb-server.x86_64
Systemctl Start mariadb
2. Security Initialization
By default, the network interface of the database opens when the
Close this interface for security needs
Netstat-antple | grep MySQL
diagram: Network interface
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/21/f2958d2dc41c7f88f39b3a97221cc128.png-wh_500x0-wm_3 -wmp_4-s_2827758384.png "title=" screenshot from 2017-11-21 13-44-34.png "alt=" F2958d2dc41c7f88f39b3a97221cc128.png-wh_ "/>
Vim/etc/my.cnf
Ten Skip-networking=1
Systemctl Restart Mariadb.service
diagram: Turn off the interface
650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/21/d5cdb81d4aa19606b48658225d86f617.png-wh_500x0-wm_3 -wmp_4-s_3846402537.png "title=" screenshot from 2017-11-21 13-39-55.png "alt=" D5cdb81d4aa19606b48658225d86f617.png-wh_ "/>
) The database initial state setting information is not secure, you need to do the following settings
Mysql_secure_installation
Mysql-uroot-p
Enter Password:
diagram: You can go straight in .
650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/21/dc32941f423aba489db9c35f4d7b0edc.png-wh_500x0-wm_3 -wmp_4-s_3598975230.png "title=" screenshot from 2017-11-21 13-46-42.png "alt=" Dc32941f423aba489db9c35f4d7b0edc.png-wh_ "/>
Figure: Encryption will not go in after
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/21/f0648a6878a2c493da8b79c75c244d00.png-wh_500x0-wm_3 -wmp_4-s_1677917775.png "title=" screenshot from 2017-11-21 13-48-07.png "alt=" F0648a6878a2c493da8b79c75c244d00.png-wh_ "/>
Diagram: Enter the password after entering
3. Password Management
) Change Password
Mysqladmin-uroot-pwestos Password Lee
Test:
Mysql-uroot-plee
Diagram:-p password can be entered directly
650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/21/50e2884b15d938da301129cdb81589b2.png-wh_500x0-wm_3 -wmp_4-s_1534550496.png "title=" screenshot from 2017-11-21 13-52-20.png "alt=" 50e2884b15d938da301129cdb81589b2.png-wh_ "/>
When the Super User password is forgotten :
Systemctl Stop MARIADB
Mysqld_safe--skip-grant-tables &
Mysql
Update Mysql.user set Password=password (' Westos ') where user= ' root '-->;
PS aux | grep MySQL
Kill-9 all process IDs for MySQL
Systemctl Start mariadb
Diagram: All process IDs for MySQL
650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/21/2910e2a67983f55fbc6cf3181146c752.png-wh_500x0-wm_3 -wmp_4-s_1687083716.png "title=" screenshot from 2017-11-21 15-41-15.png "alt=" 2910e2a67983f55fbc6cf3181146c752.png-wh_ "/>
Diagram: Directly into the background to modify the password
650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/21/c58ec7db3a5e489d13c68cddf975529e.png-wh_500x0-wm_3 -wmp_4-s_2754432021.png "title=" screenshot from 2017-11-21 13-54-57.png "alt=" C58ec7db3a5e489d13c68cddf975529e.png-wh_ "/>
Test:
Mysql-uroot-pwestos
diagram: Test success
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/21/2ffea9feefab047ef44093476de8dbf4.png-wh_500x0-wm_3 -wmp_4-s_1785617608.png "title=" screenshot from 2017-11-21 14-01-06.png "alt=" 2ffea9feefab047ef44093476de8dbf4.png-wh_ "/>
Second, MySQL use command
1. Management of the database
) Establish
Mysql-uroot-p
SHOW DATABASES;# #列出库
CREATE DATABASE Westos;# #建立库
Use Westos;# #建立表
CREATE TABLE Linux (
Username varchar (notnull),
Password varchar (notnull)
);
DESC Linux;# #查看表结构
INSERT into Lee VALUES (' Lee ', ' 123 ');# #插入数据到lee表中
SELECT * from Lee;# #查询所有字段在lee表中
SELECT Username,password from Linux;# #查询指定字段在lee表中
diagram: List libraries
650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/21/4da0a81512dd141d95f27d1c0236a2db.png-wh_500x0-wm_3 -wmp_4-s_1906821235.png "title=" screenshot from 2017-11-21 14-44-53.png "alt=" 4da0a81512dd141d95f27d1c0236a2db.png-wh_ "/>
Diagram: View table structure
650 "this.width=650;" src= "https://s2.51cto.com/oss/201711/21/ C7fb22f78fc0718365af850979282a4f.png-wh_500x0-wm_3-wmp_4-s_1567787221.png "title=" Screenshot from 2017-11-21 15-20-10.png "alt=" C7fb22f78fc0718365af850979282a4f.png-wh_ "/>
diagram: Change
650 "this.width=650;" src= "https://s4.51cto.com/oss/201711/21/ 28077e19532dc4129782d41015554839.png-wh_500x0-wm_3-wmp_4-s_4015972444.png "title=" Screenshot from 2017-11-21 15-32-00.png "alt=" 28077e19532dc4129782d41015554839.png-wh_ "/>
) Delete the
SELECT username, Password from Lee;
DELETE from Redhat where Username= ' Lee '; Span style= "font-family: ' The song Body '; Color:rgb (155,187,89);" ># #删除用户
DROP TABLE redhat # #删除表
DROP DATABASE westos # #删除库
ALTER TABLE Linux ADD class varchar;
Diagram: Delete a table
650) this.width=650; "Src=" http://img.blog.csdn.net/20170517170508138?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvtg9yav9qaxnodw1lbmcxmjm=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "style=" border:0px;vertical-align:middle; "/>
Diagram: Deleting a library
650) this.width=650; "Src=" http://img.blog.csdn.net/20170517170519889?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvtg9yav9qaxnodw1lbmcxmjm=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "style=" border:0px;vertical-align:middle; "/>
Diagram: Delete a field
650) this.width=650; "Src=" http://img.blog.csdn.net/20170517170610390?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvtg9yav9qaxnodw1lbmcxmjm=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "style=" border:0px;vertical-align:middle; "/>
Diagram: Delete information in the table
650) this.width=650; "Src=" http://img.blog.csdn.net/20170517170623123?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvtg9yav9qaxnodw1lbmcxmjm=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "style=" border:0px;vertical-align:middle; "/>) User Authorization
CREATE USER [email protected] ' localhost ' identified by ' Westos ';# #建立用户身份
GRANT Select,insert on westos.* to [email protected];# #授权
SHOW GRANTS for [email protected];# #查看授权
REVOKE INSERT on westos.* from [email protected];# #撤销授权
illustration: Viewing authorizations
650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/21/8ad84d1a93e4c7dd2ea6c26b5c81f3cd.png-wh_500x0-wm_3 -wmp_4-s_3424718949.png "title=" screenshot from 2017-11-21 15-36-08.png "alt=" 8ad84d1a93e4c7dd2ea6c26b5c81f3cd.png-wh_ "/>
2. Backup of the database
Mysqldump-uroot-pwestos Westos >/mnt/westos.sql
Mysqldump-uroot-pwestos Westos--no-data
Mysqldump-uroot-pwestos--all-database
Mysqldump-uroot-pwestos--all-database--no-data
Diagram: Backup
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/21/f5ac7b8cccf8467e44a6caf71cf70750.png-wh_500x0-wm_3 -wmp_4-s_2652627130.png "title=" screenshot from 2017-11-21 15-42-31.png "alt=" F5ac7b8cccf8467e44a6caf71cf70750.png-wh_ "/>
Recovery Mode 1
Mysql-uroot-pwestos-e "CREATE DATABASE westos;"
Mysql-uroot-pwestos Westos </mnt/westos.sql
Recovery Mode 2
Vim/mnt/westos.sql
CREATE DATABASE Westos;
Use Westos;
Mysql-uroot-pwestos </mnt/westos.sql
diagram: Modify the configuration
650 "this.width=650;" src= "https://s5.51cto.com/ Oss/201711/21/def932e6b4c0589744d5d885db6c5d14.png-wh_500x0-wm_3-wmp_4-s_3667618316.png "title=" Screenshot from 2017-11-21 15-54-50.png "alt=" Def932e6b4c0589744d5d885db6c5d14.png-wh_ "/>
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/21/7aa88f3224755008abc4e080fd4b0a1a.png-wh_500x0-wm_3 -wmp_4-s_1639490227.png "title=" screenshot from 2017-11-21 16-09-58.png "alt=" 7aa88f3224755008abc4e080fd4b0a1a.png-wh_ "/>
Diagram: Modify the configuration
650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/21/665114f972f7b425c4159bf9bd9308b0.png-wh_500x0-wm_3 -wmp_4-s_255090251.png "title=" screenshot from 2017-11-21 16-13-26.png "alt=" 665114f972f7b425c4159bf9bd9308b0.png-wh_ "/>
Four. Installing Discuz
1. Download discuz_x3.2_sc_utf8.zip
2.cd/mnt
3.unzip discuz_x3.2_sc_utf8.zip # #解压文件
4.setenforce 0 # #将selinux设置为关闭
5.chmod 777 Upload-r # #给upload权限
Diagram:discuz Introduction
650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/21/9c98021332ba57c69f0a4cc4d9be4306.png-wh_500x0-wm_3 -wmp_4-s_3858159644.png "title=" screenshot from 2017-11-21 16-52-26.png "alt=" 9c98021332ba57c69f0a4cc4d9be4306.png-wh_ "/>
# #end # #
This article is from the "13342594" blog, please be sure to keep this source http://13352594.blog.51cto.com/13342594/1983914
LINUX--MARIADB Database