1. Installation of the database
Yum Install mariadb.x86_64 mariadb-server.x86_64-y
Turn off the firewall
Shut down network Port (no outsider access)
Netstat-antlpe | grep MySQL
Vim/etc/my.cnf
650) this.width=650; "Style=" background-image:none; border-right-0px; margin:0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" clip_image002 "border=" 0 "alt=" clip_image002 "src=" http://s3.51cto.com/wyfs02/M01/87/39/ Wkiol1fyf1twjpxyaaatxcj0zlw605.gif "width=" 244 "height=" "/>
Plus skip that sentence
Restarting the database service
2. Add a password to the database
Mysql_secure_installation (select all y)
Login Mysql-uroot-pwestos (Login database)
3. Database usage
Use MySQL (enter MySQL database)
Create Database Weostos (build Westos)
CREATE TABLE Linux (
Username varchar () NOT NULL,
Password varchar (not null); (CREATE table, Username,password field)
Show DATABASES; (Show database)
Show TABLES; (Show tables in database)
DESC Linux (displaying data structures for Linux tables)
SELECT Host,user,password from Linux;
(Query the Host,user,password field in a Linux table)
SELECT * from Linux (querying all fields in a Linux table)
4. Modification of the database
INSERT into Linux VALUES (' user1 ', ' passwd ', ' age ');
UPDATE linux SET username= '[email protected]' WHERE age= ' 20 ';
ALTER TABLE linux Add sex varchar (4);
(Add the Sex field to the Linux table)
ALTER TABLE linux drop sex; Delete sex field
ALTER TABLE linux Add Sex VARCHAR (5) After password (adds sex after password)
Delete from Linux WHERE username= ' user1 ' (delete user1 row)
drop table Westos.linux Delete tables in library
Drop database Westos Delete Westos Library
5. Database Password Forget
Mysqladmin-uroot-pwestos Password Redhat
(known password change password)
Systemctl Stop MARIADB
Mysqld_safe--skip-grant &
(Skipping the Grant-tables authorization table does not require authentication to log on to the local MySQL database)
MySQL into the database
Modified 650) this.width=650; "Style=" background-image:none; border-right-0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" clip_image004 "border=" 0 "alt=" clip_image004 "src=" http://s3.51cto.com/wyfs02/M02/87/39/ Wkiol1fyf1sjnumfaaai6wnwi3i935.gif "width=" 543 "height=" "/>"
PS aux | grep MySQL
650) this.width=650; "Style=" background-image:none; border-right-0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" clip_image006 "border=" 0 "alt=" clip_image006 "src=" http://s3.51cto.com/wyfs02/M01/87/39/ Wkiol1fyf1wchyn8aabsp6pmbv4020.gif "width=" 590 "height="/>
Kill-9 3111 3269
Systemctl Start mariadb
6. Backup of the database
Mysqldump-uroot-pwestos Westos (Backup Westos)
Mysqldump-uroot-pwestos--all-databases (back up all libraries)
Mysqldump-uroot-pwestos westos >/mnt/westos.sql (Backup Westos to/mnt/)
Recovery of the database:
MYSQL-UROOT-PWESTOS-E "CREATE database Westos;" (Create Westos Library)
Mysql-uroot-pwestos Westos </mnt/westos.sql (Restore Westos Backup)
7. Add and access permissions for database users
Create user [email protected] ' localhost ' identified by ' Redhat ';(creating local test users)
CREATE USER [email protected] '% ' identified by ' Redhat ';
(Create a network user, you can log in from any remote host)
GRANT SELECT on westos.* to [email protected];
(View Westos Library permissions for Lee users)
GRANT all on * * to [email protected];
(Give the lee user all permissions for all databases)
SHOW GRANTS for [email protected];
(View all the rights of the Lee user)
GRANT Select,insert on westos.* to [email protected] (SELECT and INSERT permissions to Lee in the Westos Library)
REVOKE SELECT on westos.* from [email protected]; (Remove the lee user's SELECT permission in the Westos library)
drop user [email protected];(remove Lee User)
SELECT user from Mysql.user; (View all users in the system)
8. Database of graphical interfaces
1. Install Httpd,php,php-mysql Close Firewall
Restart httpd
2. Download phpmyadmin-3.4.0-all-languages.tar.bz2
Tar jxf phpmyadmin-3.4.0-all-languages.tar.bz2-c/var/www/html/(Specify the location after decompression)
3.MV phpmyadmin-3.4.0-mysqladmin Renaming
4. Enter Mysqladmin
CP config.sample.inc.php config.inc.php
5. Modify config.inc.php fill in ' Cookie '
650) this.width=650; "Style=" background-image:none; border-right-0px; padding-left:0px; padding-right:0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px; padding-top:0px "title=" clip_image008 "border=" 0 "alt=" clip_image008 "src=" http://s3.51cto.com/wyfs02/M00/87/3C/ Wkiom1fyf1aw90d6aabdigbcqbm182.gif "width=" 563 "height=" 318 "/>
Using a browser to access the graphical interface is to use the database
MYSQL-E (displayed by row)-N (no database displayed)
Basic part of Database mariadb