MARIADB Database Services

Source: Internet
Author: User
Tags db2 phpmyadmin myadmin


  What is MARIADB?
MARIADB database management System is a branch of MySQL, mainly by the open source community in
Maintenance, the GPL licensed MARIADB is fully compatible with MySQL, including APIs and
The command line makes it easy to be a replacement for MySQL. In the storage engine, use the XTRADB
(English: XtraDB) to replace MySQL's InnoDB. MARIADB by MySQL's
Founder Michael Widenius (English: Michael Widenius) led the development of his early
After selling the company MySQL AB, which was created for $1 billion before, to Sun,
As Sun was acquired by Oracle, MySQL's ownership also fell into Oracle's hands. MariaDB
The name comes from Michael Widenius's daughter Maria's name.

1.MARIADB installation

1-1 Installing the MARIADB and Mariadb-client components:
# yum Groupinstall-y mariadb mariadb-client
1-2 Start the MARIADB service:
# Systemctl start mariadb; Systemctl Enable MARIADB
[[email protected] ~]# ss-antple|grep MySQL
LISTEN 0 *:3306 *:*
Users: (("mysqld", 2622,13) uid:27 ino:36479 sk:ffff8800235a0000 <->

1-4 Edit the/etc/my.cnf file and add the following parameters to [mysqld]:
Skip-networking=1
1-5# systemctl Restart mariadb
# SS-ANTLP |grep MySQL only allows local connections via socket files at this time, blocking
All TCP/IP connections from the network.
2. Use the Mysql_secure_installation tool for database security settings and follow the prompts to complete
Operation:

# mysql_secure_installation
[Email protected] ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation:line 379:find_mysql_client:command not found

Note:running all PARTS of this SCRIPT are RECOMMENDED for all MariaDB
SERVERS in PRODUCTION use! Please READ each STEP carefully!

In order to log into MariaDB to secure it, we'll need the current
Password for the root user. If you ' ve just installed MariaDB, and
You haven ' t set the root password yet, the password would be blank,
So, should just press ENTER here.

Enter current password to root (enter for none):
OK, successfully used password, moving on ...

Setting The root password ensures that nobody can log into the MariaDB
Root user without the proper authorisation.

Set root Password? [y/n]
New Password:
Re-enter new password:
Password Updated successfully!
Reloading privilege tables.
... success!


By default, a MariaDB installation have an anonymous user, allowing anyone
To log into MariaDB without has to has a user account created for
them. This was intended only for testing, and the installation
Go a bit smoother. You should remove them before moving into a
Production environment.

Remove anonymous users? [y/n]
... success!

Normally, Root should only is allowed to connect from ' localhost '. This
Ensures that someone cannot guess at the root of password from the network.

Disallow Root login remotely? [y/n]
... success!

By default, MariaDB comes with a database named ' test ' that anyone can
Access. This was also intended only for testing, and should be removed
Before moving into a production environment.

Remove test database and access to it? [y/n]
-Dropping test database ...
... success!
-Removing privileges on test database ...
... success!

Reloading the privilege tables would ensure that all changes made so far
would take effect immediately.

Reload privilege tables now? [y/n]
... success!

Cleaning up ...

All done! If you ' ve completed all of the above steps, your MariaDB
Installation should now is secure.

Thanks for using mariadb!
[Email protected] ~]#

3. Log in to the database:

# mysql-u Root-penter password:redhatmariadb [(None)]> show databases;+--------------------+| database|+--------------------+| Information_schema | | mysql| | Performance_schema |+--------------------+3 rows in Set (0.00 sec) MariaDB [(none)]> quit
4. Database basic Operations SQL
show databases;                             display database use MySQL;                             Enter the database show tables;                             display the table in the database desc user;                           view data structure of user table flush Privile Ges                         Refresh database information select Host.user,password from U Ser                 Query the Host,user,password field in the User table create database Westos;                         to create Westos database use Westos;                            create table Linux (&nbsp ;             &NBSP;         CREATE TABLE, Username,password field username varchar () not null,password varchar (n) not null); SELECT * F Rom Mysql.user;                     Query the user table under MySQL library so ALTER TABLE Linux add age varchar ( 4);                 Add the Age field to a Linux table in ALTER TABLE Linux drop age;alter table Linux add age varchar (4) after Username;show Tables;desc Linux; INSERT into Linux values (' User1 ', ' passwd1 ');                 Insert a value of username = User1,password = password1update Linux set p in a Linux table Assword=password (' Passwd2 ') where username=user1;     Update the User1 password for the Linux table to Password2delete from Linux where Username=user1;                     Delete user1 content in Linux tables
5.mysql Password Recovery
1) #systemctl Stop mariadb
2) #mysql_safe--skip-grant &
3) #mysql
Update Mysql.user set Password=password (' Westos ') where user= ' root '; Update Mysql.user The password for the root user in the table is encrypted Westos 4) killall-9 Mysqld_safe Ps-aux | grep MySQL kill-9 * * * 5) systemctl start mariadb
6. Users and access rights
Create userCREATE USER [email protected] identified by ' Westos '; CREATE USER [email protected] '% ' identified by ' Redhat ';User AuthorizationGRANT Insert,update,delete,select on mariadb.* to [email protected]; GRANT SELECT on mariadb.* [email protected] '% ';Overloaded Authorization TableFLUSH privileges;View User AuthorizationsSHOW GRANTS for [email protected];Revoke user RightsREVOKE Delete,update,insert on mariadb.* from [email protected];Delete UserDROP USER [email protected];
7. Backup and Recovery
Backup# mysqldump-uroot-predhat Westos > westos.dump# mysqldump-uroot-predhat--all-databases > backup.dump# mysqldump -uroot-predhat--no-data westos > Westos.dump # #只备份框架, do not back up data.Recovery# Mysqladmin-uroot-predhat Create DB2 or MYSQL-UROOT-PREDHAT-E ' Create DATABASE DB2; # Mysql-uroot-predhat DB2 < Westos.dump
8. Web Management database
1) Install software http,php,php-mysql (phpmyadmin-3.4.0-all-languages) 2) cd/var/www/html3) Download extract PHP compression pack, 4) MV        Phpmyadmin-3.4.0-all-languages/myadmin 5) CD MYADMIN/6) CP config.sample.inc.php config.inc.php vim config.inc.php       $cfg [' blowfish_secret '] = ';  ==> $cfg [' blowfish_secret '] = ' Steven '; 7) Systemctl Restart httpd 8) 172.252.254.x/myadmin
Database backup Scripts
#!/bin/bashhello=$1. ' Date +%y-%m-%d '. Sqlread-p "Please input your user name:" nameread-s-P "Please input the user PA ssWOrd: "Passwordmkdir/mydata &>/dev/nulltouch/mydata/$HELLOmysqldump-u$name-p$password $ >/mydata/$HEL Loecho-e "\nthe backup successful!"
  
  


This article from the "Technology life, Simple not simple" blog, please be sure to keep this source http://willis.blog.51cto.com/11907152/1850896

MARIADB Database Services

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.