Install MariaDB for basic usage of Mysql and mariadb for mysql
I am a beginner at mysql. I wrote a blog for the first time. In order to help me remember more deeply, I also explained the experiences and difficulties of beginners from a small perspective. It is also a record of my own growth pace.
I used mysql on ubuntu for the first time. Now I use centOS 7 in the Red Hat branch of linux. During installation, MariaDB is commonly used to replace mysql, through data query, we found that Mariadb is one of the branches of mysql. It is a version of a mysql Branch developed by a team led by the founder of mysql, since mysql is gradually closed and updated slowly after being acquired by Oracle, many Linux releases gradually abandon this popular open source databaseMySQL vulnerabilities in major Linux releases
Due to the fact that MySQL is gradually closed and updated slowly after it is acquired by Oracle, many Linux distributions gradually abandon this popular open source database and turn to MariaDB,
Although PostgreSQL has always been a direct competitor to MySQL,However, what truly gives it a fatal blow seems more like MariaDB.MariaDB is also the most critical attack.
Let's take a closer look at MariaDB. In fact, MariaDb's operations are basically the same as those of Mysql, but the performance is improved based on Mysql, currently, MariaDB is far faster than the Oracle team. After all, it is a team led by the founder of Mysql.
MariaDb Installation
In linux
Yum install mariadb-server# Ask if you want to install it. Enter Y to install it automatically.
Basic commands of the mariaDBde Service
[Root @ 127 ~] #Systemctl start mariadb. service# Start MariaDB [root @ 127 ~] #Systemctl stop mariadb. Service# Stop MariaDB [root @ 127 ~] #Systemctl restart mariadb. Service# Restart MariaDB [root @ 127 ~] #Systemctl enable mariadb. Service# Set automatic start upon startup
[Root @ 127 ~] #Systemctl disenable mariadb. service# Set auto-start and close upon startup
Initialize the root password
[Root @ 127 ~] # Mysql_secure_installation # Add password FOR root account OF initialization NOTE: running all parts of this script is 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 currentpassword for the root user. if you 've just installed MariaDB, andyou haven' t set the root password yet, the password will be blank, so you shoshould just press enter here. enter current password for root (enter for none): Enter the root password here. If the initial password is empty for the first time, press enter (before press Enter)
Enter current password for root (enter for none): Enter the root password here. If the initial password is empty for the first time, press enter (Press Enter to confirm) OK, successfully used password, moving on... setting the root password ensures that nobody can log into the MariaDBroot user without the proper authorisation. you already have a root password set, so you can safely answer 'n '. change the root password? [Y/n] yNew password: enter the new password Re-enter new Password: enter the duplicate password updated successfully! Reloading privilege tables... Success! By default, a MariaDB installation has an anonymous user, allowing anyoneto log into MariaDB without having to have a user account created forthem. this is intended only for testing, and to make the installationgo a bit smoother. you shoshould remove them before moving into aproduction environment. remove anonymous users? [Y/n] y... Success! Normally, root shoshould only be 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! By default, MariaDB comes with a database named 'test' that anyone canaccess. this is also intended only for testing, and shocould be removedbefore moving into a production environment. remove test database and access to it? [Y/n] y-Dropping test database... ERROR 1008 (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 will ensure that all changes made so farwill take effect immediately. Reload privilege tables now? [Y/n] y... Success! Cleaning up... All done! If you 've completed all of the above steps, your MariaDBinstallation shoshould now be secure. Thanks for using MariaDB!
# The password is successfully modified.
Database Logon
[Root @ 127 ~] # Mysql-uroot-proot
# Mysql-u here is the user name (root by default) & I am a Space &-p here is the password (blank by default)
This indicates that you have entered MariaDB.
Welcome to the MariaDB monitor. commands end with; or \ g. your MariaDB connection id is 23 Server version: 5.5.50-MariaDB ServerCopyright (c) 2000,201 6, Oracle, MariaDB Corporation AB and others. type 'help; 'or' \ H' for help. type '\ C' to clear the current input statement. # using/h, you can view many commands MariaDB [(none)]> here is the entry to the input SQL statement
The above is the installation of MariaDB
Next is the basic learning of native SQL statements.