Beginner MySQL Small white, for the first time to write a blog, in order to allow themselves to remember more profound, but also a small white angle to explain the experience and difficulties of beginners, but also a record of their own growth pace bar
My first time using MySQL is on Ubuntu, now using the Red Hat branch of the Linux CentOS 7, installed to find usually is mariadb to replace MySQL, through the data query found that MARIADB is one of the branches of MySQL, A version of the MySQL branch developed by the team of MySQL founders, because MySQL was increasingly closed and slow to update after Oracle's takeover, and many Linux distributions gradually abandoned the popular open source database, making MySQL has been disgraced in major Linux distributions
Due to dissatisfaction with MySQL after Oracle acquisition of the increasingly closed and slow update, many Linux distributions gradually abandoned the popular open source database, and turned to MARIADB,
Although PostgreSQL has always been treated as a direct competitor to MySQL, it seems more like a mariadb to give it a deadly hit, and mariadb will be a fatal blow to MySQL later.
On the other, we come to specific talk about mariadb, in fact, mariadb operation and MySQL operation basically the same, just based on MySQL performance improvement, the current MARIADB update speed has far exceeded the speed of the Oracle team, After all, the MySQL founders led the team, how not to reassure people.
Installation of MARIADB
Linux down through
Yum install mariadb mariadb-server #询问是否要安装, enter Y to install automatically
Basic commands for Mariadbde services
[Email protected] ~]#systemctl start Mariadb.service #Start mariadb[email protected] ~]# systemctl stop mariadb . Service #Stop mariadb[email protected] ~]# systemctl restart mariadb . Service #Restart mariadb[email protected] ~]# systemctl enable mariadb . Service #Set boot auto-start
[Email protected] ~]# systemctl disenable mariadb.service#设置开机自启关闭
Initialize root password
[[Email protected] ~]#mysql_secure_installation #为初始化账户root添加密码NOTE: RUNNING all PARTS of this SCRIPT is RECOMMENDED forAll MariaDB SERVERS in PRODUCTION Use! Please READ eachSTEP carefully!In order toLoginto MariaDB to secure it, we 'll need the CurrentPassword for the root user. If You' ve just installed MariaDB,Andyou Haven‘t set the root password yet, the password would be a blank,so you should just press ENTER here. Enter current password to root (enter for none):here to fill in the root password, if it is the first time the initial password is empty direct hit enter (before carriage return)
Enter CurrentPassword forRoot (enter forNone):here to fill in the root password, if it is the first time to initialize the password is empty directly hit enter (after carriage return ↓)OK, successfully used password, moving on ...Setting The root password ensures that nobody canLogInto the mariadbroot user without the proper authorisation.You already has a root password setSo can safely answer ' n '.Change the root password? [y/N] y NewPassword here to fill in the new password Re-enterNewPassword here fill in the duplicate password Password updated successfully!Reloading Privilege Tables.. ... success! bydefault, a MariaDB installation have an anonymous user,allowing AnyonetoLogInto MariaDB without has to has a user account created forthem. This was intended only fortesting,And to make the installationgo a bit smoother.You should remove them before moving into aproduction environment.Remove Anonymous Users? [y/N] y ... success!normally, Root should only is allowed to connect from ' localhost '.Thisensures that someone cannot guess at the root password from the network.Disallow Root Login remotely? [y/N] y ... success! bydefault, MariaDB comes with a database named ' Test 'That anyone canaccess. This was also intended only fortesting,And should is removedbefore moving into a production environment.Remove test database and access to it? [y/N] y -Dropping test database ...ERROR1008 (HY000) at line 1:can ' t drop database ' test '; Database doesn 'T exist... failed! Not critical, keep moving ...-removing privileges on test database ... success!reloading the privilege tables would ensure that all changes made so farwill take effect immediately.Reload Privilege Tables now? [y/N] y ... success!Cleaning up... All Done!IfYou 've completed all of the above steps, your mariadbinstallation should now is secure. Thanks for using mariadb!
# This indicates a successful password change
Database Login
~]# mysql-uroot -pRoot
# Mysql-u Here is the username (default is root) & I am space &-P here is the password (default is empty)
This means that it has entered mariadb.
Welcome to the MariaDB Monitor. end with; or \g.%Server version: 5.5.50-, Oracle, MariaDB Corporation Ab and others. for current input statement. # can view many commands MariaDB [(none)] with/h here is the entry for the input SQL statement
The above is the installation of MARIADB
Next is the SQL Native statement Basic Learning
MySQL Foundation using the MARIADB installation