Lesson three unit8 mariadb

Source: Internet
Author: User
Tags phpmyadmin

1.yum intall mariadb-server-y # #安装mariadb服务

Systemctl Start MARIADB # #开启服务

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/95/C6/wKioL1kZiX_CdXM3AAAWvJ5H8Wk052.png "style=" float : none; "title=" O%d9]48]l@41mw}qu]_3b@j.png "alt=" Wkiol1kzix_cdxm3aaawvj5h8wk052.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/95/C6/wKioL1kZiX_QOZY9AAAeDqhmtN8834.png "style=" float : none; "title=" 1x8d[_qlvzjb73x{w66swru.png "alt=" Wkiol1kzix_qozy9aaaedqhmtn8834.png "/>

VIM/ETC/MY.CNF # #修改配置文件

Systemctl Restart MARIADB #重启服务

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/95/C6/wKiom1kZih_B-rHfAAAwyPYIAps498.png "title=" l166l %eqt7h~txagzw7}1b0.png "alt=" Wkiom1kzih_b-rhfaaawypyiaps498.png "/>

Modify Content

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/95/C6/wKioL1kZikyxbbQuAAAmKr1lJDc759.png "title=" R) 78e38mrld6p (ivir72w7f.png "alt=" Wkiol1kzikyxbbquaaamkr1ljdc759.png "/>

* * Skip Symbolic links

Mysql_secure_installtion # #mysql加密

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/95/C6/wKioL1kZjE2w92U_AAAm3zswX3c462.png "title=" qcz$$ $H 6n@m%17ge7mmsh) h.png "alt=" Wkiol1kzje2w92u_aaam3zswx3c462.png "/>

* *Enter current password to root (enter for none): # #数据库原始密码, enter directly

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/95/C6/wKioL1kZjF_jyiICAAAbgMI1cmo578.png "title=" L20PPYSU0DC5 (7b5lpfb5]a.png "alt=" Wkiol1kzjf_jyiicaaabgmi1cmo578.png "/>

**change the root password? [y/n] Y # #是否设定数据库root密码

New Password: # #输入密码

Re-enter new password: # #重复密码

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/95/C6/wKiom1kZjQywgt2hAAAqDgXzHsY269.png "title=" T2@19dilzy[me0$r%3%]v5o.png "alt=" Wkiom1kzjqywgt2haaaqdgxzhsy269.png "/>

**remove anonymous users? [y/n] Y # #是否删除匿名用户访问权限

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/95/C6/wKiom1kZjXLyKSVgAAASymSqnfU217.png "title=" t8$} Udof1l[e8pg}xa9%z$3.png "alt=" Wkiom1kzjxlyksvgaaasymsqnfu217.png "/>

**disallow Root login remotely? [y/n] Y # #是否禁止超级用户远程登录

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/95/C6/wKioL1kZjq3RMuhFAAAWNR7MfDc676.png "title=" sp4z1 %2az (Q3PF)}7em7qop.png "alt=" Wkiol1kzjq3rmuhfaaawnr7mfdc676.png "/>

* *Remove Test database and access to it? [y/n] Y # #是否删除测试数据

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/95/C6/wKiom1kZjrjTNmmFAAAzCLxhzZ8028.png "title=" n7$w ( n~@~j[5egjp9$ac[(2.png "alt=" Wkiom1kzjrjtnmmfaaazclxhzz8028.png "/>

   ** Reload privilege tables now? [y/n] Y # #重新加载服务

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/95/C6/wKiom1kZjsDh1BSjAAAVnBnmdWE449.png "title=" h5{$ 2p$yjstr@yf6whjx[at.png "alt=" Wkiom1kzjsdh1bsjaaavnbnmdwe449.png "/>

2. Basic SQL statement operations for the database

(1) Login

Mysql-uroot-p ##-u on behalf of user-p password

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/95/C6/wKioL1kZjzXCFucJAACQAYIRmw0555.png "title=" 6v{ NLLQQV$TYB8H2O) x x (u.png "alt=" Wkiol1kzjzxcfucjaacqayirmw0555.png "/>

(2) Enquiry

show databases; # #显示数据库

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/95/C6/wKiom1kZkCLxtkacAAA8YbVKNH8633.png "title=" Qnt2i4fpezgln{3_[15kd9e.png "alt=" Wkiom1kzkclxtkacaaa8ybvknh8633.png "/>

Use MySQL; # #进入MySQL库

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/95/C6/wKioL1kZkEai9jdCAABOiPtWB0Y732.png "title=") A_ R@JG) 5vq8_e]c~u) [2}g.png "alt=" Wkiol1kzkeai9jdcaaboiptwb0y732.png "/>

Show tables; # #显示数据库里表的名称

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/95/C6/wKioL1kZkF_xC0RTAAA4RHx7BZk257.png "title=" @[[ Pms5%npsczr9%3u99l]y.png "alt=" Wkiol1kzkf_xc0rtaaa4rhx7bzk257.png "/>

select * from user; # #查询user表中所有内容

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/95/C6/wKiom1kZkHjAo213AADGelLZfSA831.png "title=" 22oxge}gl{] @H7KZP3UVMRN. png "alt=" Wkiom1kzkhjao213aadgellzfsa831.png "/>

DESC user; # #查询user表的结构 (Show table header)

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/95/C6/wKiom1kZkJLwjCojAABwsTShF1o487.png "title=" _mw}~ 6k@pjmz]28~qa (39eq.png "alt=" Wkiom1kzkjlwjcojaabwstshf1o487.png "/>

(3) Establishment of the database

Create Database Westos; # #建立westos库

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/95/C7/wKiom1kZkaTA8zk-AABomU-79vc256.png "title=" x2bb$ gzt%8z) rokzu8}ddis.png "alt=" Wkiom1kzkata8zk-aabomu-79vc256.png "/>

CREATE TABLE Linux (# #建立Linux表, and there are two fields of username and password

Username varchar () NOT NULL,

Password varchar () NOT NULL

);

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/95/C7/wKiom1kZkeGAZVuoAABKOT6S9gQ173.png "title=" r0@$ Lgf374lf%q[]~z ' L (09.png "alt=" Wkiom1kzkegazvuoaabkot6s9gq173.png "/>

INSERT into Linux values (' user1 ', ' 123 ') # #给Linux表里写入内容

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/95/C7/wKioL1kZkfqQWDp8AABozZucYRU278.png "title=" Klt1dyi4psgv$sr2p2yk ' U2.png "alt=" Wkiol1kzkfqqwdp8aabozzucyru278.png "/>

(4) Update of the database

Update Linux set Password=password (' 456 ') where username= ' User1 '; # #加密更新user1密码

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/95/C7/wKiom1kZlKyB9-oSAABsmSzGctM095.png "title=" 6z~4 " Qc98ku4dz3ac1s047b.png "alt=" Wkiom1kzlkyb9-osaabsmszgctm095.png "/>

Update Linux set Password=password (' 456 ') where (username= ' user2 ' or username= ' user3 '; # #更新user2和user3密码

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/95/C7/wKioL1kZlMnTPH1jAABrKq8aS0A477.png "title=" egri9etpt_j@} @ZVY6%oguq.png "alt=" Wkiol1kzlmntph1jaabrkq8as0a477.png "/>

Delete from Linux where where username= ' user1 '; # #删除user1密码

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/95/C7/wKiom1kZlOaAPmOwAABLXM78xvs160.png "title=" f]3{ 56c1qy2]lu1{~3rsb2o.png "alt=" Wkiom1kzloaapmowaablxm78xvs160.png "/>

ALTER TABLE Linux add age varchar (4); # #在Linux表最后添加age列

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/95/C7/wKioL1kZlQOCLzZuAABcOOmTo5A124.png "title=" J (8} f95a ' $Q 4m~%f~][hx9f.png "alt=" Wkiol1kzlqoclzzuaabcoomto5a124.png "/>

ALTER TABLE Linux add year varchar (4) after Age # #在age字段后添加year字段

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/95/C7/wKiom1kZlWaSYPlDAABmI3CT5mQ466.png "title=" DUMOA8DIUNPH8ZTCLBTW ' Nb.png "alt=" Wkiom1kzlwasypldaabmi3ct5mq466.png "/>

ALTER TABLE Linux drop age; # #删除age字段

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/95/C7/wKioL1kZlYXgOfqsAABoX31zoeA034.png "title=" 5X ( Tpq_@li6owxtm (8J (}o8.png "alt=" Wkiol1kzlyxgofqsaabox31zoea034.png "/>

(5) Deleting a database

Drop TABLE Linux # #删除Linux表

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/95/C7/wKiom1kZllLz1R6DAABCTE4mz04883.png "title=" PDIM@FPDA2NJKP) dal9m (~j.png "alt=" Wkiom1kzlllz1r6daabcte4mz04883.png "/>

Drop Database Westos # #删除westos库

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/95/C7/wKiom1kZlm_CvWXgAAByOQ3QXgM122.png "title=" JHCK3 %opc$90wz{dfb]lc~r.png "alt=" Wkiom1kzlm_cvwxgaabyoq3qxgm122.png "/>

(6) Backup of the database

Mysqldump-u root-p123--all-database # #备份表中所有数据

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/95/C7/wKioL1kZmHuivt9pAAEMQzmcvNI372.png "title=" 2a1tywx_ ' $7g[ia7[ww6{rf.png "alt=" Wkiol1kzmhuivt9paaemqzmcvni372.png "/>

Mysqldump-u root-p123--all-database--no-data # #备份所有表, do not back up data

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/95/C7/wKiom1kZmJmTa1U6AAFGB1Ytkfo317.png "title=" P7) l_ t6y5}~ @NLF_J98HQLC. png "alt=" Wkiom1kzmjmta1u6aafgb1ytkfo317.png "/>

Mysqldump-u root-p123 Westos # #备份westos库

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/95/C7/wKioL1kZmLOiWyHKAAFJDWKVUOo731.png "title=" lqd$% E}a2y9[p9 ' R6610oye.png "alt=" Wkiol1kzmloiwyhkaafjdwkvuoo731.png "/>

Mysqldump-u root-p123 westos >/mnt/westos.sql # #备份westos库保存到westos. sql

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/95/C7/wKiom1kZmNLg8oeQAAAsBxp566g399.png "title=" vg@tny2d) $FHL (K ([3cy6nr.png "alt=" Wkiom1kzmnlg8oeqaaasbxp566g399.png "/>

Mysqldump-u root-p123 Westos linux >/mnt/linux.sql # #备份westos库中的Linux表

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/95/C7/wKioL1kZmQOyLclUAAAggHe_q9M702.png "title=" GWK9] ) t}0c_@}k5znai{c ' X.png "alt=" Wkiol1kzmqoylcluaaagghe_q9m702.png "/>

Mysql-u root-p123-e "CREATE Database Westoss;" # #建立westos库

Mysql-u root-p123 Westos </mnt/linux.sql # #导入数据到westos库


* * Test

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/95/C7/wKiom1kZmWawaMcxAABLJ9FU5J4168.png "title=" z$hj[ A4otpc@[dun_$y2rta.png "alt=" Wkiom1kzmwawamcxaablj9fu5j4168.png "/>

(7) User authorization

Create user [email protected] identified by ' WS '; # #创建用户ws, can only be logged on by this computer

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/95/C7/wKioL1kZmrmykAAzAACMYSGpPME333.png "title=" "H78 () ' NP ' b3%a ' eps%o$9.png "alt=" Wkiol1kzmrmykaazaacmysgppme333.png "/>

Create user [email protected] '% ' identified by ' WS '; # #创建用户ws, can only be logged on through the network

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/95/C7/wKiom1kZmtbyUNyCAABxgGMKKYY402.png "title=" I ' Nzu5wy@kn]z ' c8y)% ' 3~5.png "alt=" Wkiom1kzmtbyunycaabxggmkkyy402.png "/>

Grant Insert,update,delete,select on Westos.linux to [email protected] # #用户授权

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/95/C8/wKioL1kZmvfhGvsdAADoinm9Ll8944.png "title=" ~{@$ F8 ' Oq${ptg%zz5[lo) q.png "alt=" Wkiol1kzmvfhgvsdaadoinm9ll8944.png "/>

Revoke delete on westos.linux from [email protected] # #删除用户授权

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/95/C8/wKioL1kZmxaCfg5SAACRy4a8yic011.png "title=" G ' krip$ $IGD [rh{r}f]6[' I.png "alt=" Wkiol1kzmxacfg5saacry4a8yic011.png "/>

drop user [email protected] '% ' # #删除用户

650) this.width=650; "src=" https://s3.51cto.com/wyfs02/M00/95/C8/wKiom1kZm0mDZ3LEAABPSGzgkHQ967.png "title="% (y_@ AK@WP (P ' 75p3 ' q{60t.png "alt=" Wkiom1kzm0mdz3leaabpsgzgkhq967.png "/>

(8) Change Password

mysqladmin-uroot-p123 Password 456

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/95/C8/wKioL1kZm6ShawCxAACmZp80USc335.png "title=") Z5HXXFIIH6BL{Z_N2TL) it.png "alt=" Wkiol1kzm6shawcxaacmzp80usc335.png "/>

Mysqld_safe--skip-grant-table & # #开启MySQL登录接口忽略授权表

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/95/C8/wKioL1kZnVjAlcJMAABvKcb7rJc434.png "title=" b@10~ m[@Z6HS4K]%_k89e@j.png "alt=" Wkiol1kznvjalcjmaabvkcb7rjc434.png "/>

MySQL # #不要密码登录

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/95/C8/wKiom1kZnTGBFSRAAACGNZ1i2ac504.png "title=" udf~ 3299heoqateh205x5pl.png "alt=" Wkiom1kzntgbfsraaacgnz1i2ac504.png "/>

Update Mysql.user set Password=password (' 123 ') where user= ' root ' # #更新root密码

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/95/C8/wKioL1kZnYKjsIXqAABk7EJ8CyQ755.png "title=" Gv{p1 [%b~3a4y (4v1dad{30.png "alt=" Wkiol1kznykjsixqaabk7ej8cyq755.png "/>

PS aux | grep MySQL # #过滤MySQL进程并结束

Kill-9

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/95/C8/wKiom1kZnavQoxhaAADul6eamIg695.png "title=" J86WV6ED]2[Q8Q1]) 4hjk7a.png "alt=" Wkiom1kznavqoxhaaadul6eamig695.png "/>

Systemctl Start Maraidb # #重启MySQL

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/95/C8/wKioL1kZncTg9QGkAAB5bjKXRDI422.png "title=" _q[ YJ1 ' 8}m3wtqphkh$a3ep.png "alt=" Wkiol1kznctg9qgkaab5bjkxrdi422.png "/>

3. Database Web page management tools

Yum Install httpd php phy-mysql-y # #安装服务

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/95/C8/wKioL1kZnsvQLieVAAB3Y0CC1yE273.png "title="}12g4 (Bll5qg32rx$m (%[v3.png "alt=" Wkiol1kznsvqlievaab3y0cc1ye273.png "/>

Systemctl Start httpd

Systemctl Enable httpd

Systemctl Stop Firewalld

Systemctl Disable FIREWALLD

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/95/C8/wKioL1kZnz_zE4ikAABkTapaFis013.png "title=" ULC '} Go3gq ' E8kfk5kixf6v.png "alt=" Wkiol1kznz_ze4ikaabktapafis013.png "/>

Tar jxf phpmyadmin-3.4.0-all-languages.tar.bz2-c/var/www/html # #解压文件到指定目录

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/95/C8/wKiom1kZoGCyRrdAAAAtwmla9RI794.png "title=" ({J ( DZ ({_6xy (xge8[]_acg.png "alt=" Wkiom1kzogcyrrdaaaatwmla9ri794.png "/>

MV Phpmyadmin-3.4.0-all-languages/mysqladim # #重命名文件

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/95/C8/wKiom1kZoH-hLZhOAAA-gOru7G0316.png "title=" a7y[v } ' C2}90o[35x}dxi[j.png ' alt= "Wkiom1kzoh-hlzhoaaa-goru7g0316.png"/>

CD Mysqladim

Cp-p config.sample.inc.php config.inc.php # #复制模板

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/95/C8/wKiom1kZoJrBeUKWAAA_qRQ3crs133.png "title=" 8NK} rq$[2ph@ ' Lajmjq9ykm.png "alt=" Wkiom1kzojrbeukwaaa_qrq3crs133.png "/>

Vim config.inc.php # #编辑配置文件

Systemctl Restart httpd

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/95/C8/wKioL1kZoNfDAstBAABN-E-T7FM457.png "title=" ~ ' g}2 ) 3}lgzxnlb6uk5l9~8.png "alt=" Wkiol1kzonfdastbaabn-e-t7fm457.png "/>

* * Modify configuration file contents

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/95/C8/wKiom1kZoPvhwwz-AAApomEsAkE821.png "title=" $FGI { D0) 0hsn{sd1[dqrekx.png "alt=" Wkiom1kzopvhwwz-aaapomesake821.png "/>,

* * Test

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/95/C8/wKioL1kZoR3xjMAcAAD4_vDq554735.png "title=" TYTF5 [Xl[9 ' 4724h~kz6}c3.png "alt=" Wkiol1kzor3xjmacaad4_vdq554735.png "/>

Lesson three unit8 mariadb

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.