Centos7 installation mariadb-10, centos7mariadb-10
:
Http://mirrors.ustc.edu.cn/mariadb/mariadb-10.0.19/source/mariadb-10.0.19.tar.gz
Because cmake is used, this can be installed offline.
Yum install cmake
Download the tar.gz file and decompress it to the specified directory tar-zxvf XXX.tar.gz.
Go to the installation directory
Hcr@localhostmariadb-10.0.19 $ pwd
/App/mysql/mariadb-10.0.19
// Create a user group, directory to be installed, and database directory
[Hcr@localhostmariadb-10.0.19] $ sudo groupadd mysql
[Sudo] password forhcr:
[Hcr@localhostmariadb-10.0.19] $ sudo useradd-g mysql-s/bin/false
[Hcr@localhostmariadb-10.0.19] $ mkdir-p/app/data/mysql
[Hcr@localhostmariadb-10.0.19] $ sudo chown-R mysql: mysql/app/data/mysql/
[Hcr@localhostmariadb-10.0.19] $ mkdir/app/local/mysql
Cmake.-DCMAKE_INSTALL_PREFIX =/app/local/mysql-DMYSQL_DATADIR =/app/data/mysql/-DSYSCONFDIR =/etc
You may encounter a lack of ncurses (reporting the Curseslibrary not found exception). You can install it,
Yum installncurses-devel or the specified rpm Installation
[Hcr@localhostmariadb-10.0.19] $ make
// This is a little slow. I am going to my father. It's too long for me to wait. I knew I should choose
[Hcr@localhostmariadb-10.0.19] $ make install
// A bunch of installing
[Hcr@localhostmariadb-10.0.19] $ cd/app/local/mysql/
[Hcr @ localhostmysql] $ sudo cp support-files/my-huge.cnf/etc/my. cnf
[Hcr @ localhostmysql] $ sudo vi/etc/my. cnf // edit the configuration file. Add datadir =/app/data/mysql // to the MariaDB database path in [mysqld ].
Datadir =/app/data/mysql
[Hcr @ localhostmysql] $ sudo cp support-files/my-huge.cnf/etc/my. cnf
[Hcr @ localhostmysql] $ sudo cp./support-files/mysql. server/etc/rc. d/init. d/mysqld
[Hcr @ localhostmysql] $ sudo chmod 755/etc/init. d/mysqld
[Hcr @ localhostmysql] $ sudo chkconfig mysqld on
[Hcr @ localhostmysql] $ sudo vi/etc/rc. d/init. d/mysqld
The default value is
Basedir =
Datadir =
Change
Basedir =/app/local/mysql # MariaDB installation path
Datadir =/app/data/mysql # MariaDB database storage directory
// Start the service
[Hcr @ localhostmysql] $ sudo service mysqld start
Starting MySQL. SUCCESS!
// Configure it to the environment
[Hcr @ localhostmysql] $ sudo vi/etc/profile // added an environment variable
ExportPATH = $ PATH:/app/local/mysql/bin
Restart the machine here
[Hcr @ localhostmysql] $ sudo shutdown-r now
Initialize mysqlroot Password
[Root @ localhost ~] # Mysql_secure_installation
NOTE: running allparts of this script is recommended for all MariaDB
Servers inproduction use! Please read each step carefully!
In order to log every mariadb to secure it, we'll need the current
Password for theroot user. If you 've just installed MariaDB, and
You haven't set theroot password yet, the password will be blank,
So you shoshould justpress enter here.
Enter currentpassword for root (enter for none ):
ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: YES)
Enter currentpassword for root (enter for none ):
ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: YES)
// Initialize and enter directly.
Enter currentpassword for root (enter for none ):
OK, successfullyused password, moving on...
Setting the rootpassword ensures that nobody can log into the MariaDB
Root user withoutthe proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter newpassword:
Password updatedsuccessfully!
Reloading privilegetables ..
... Success!
By default, aMariaDB installation has an anonymous user, allowing anyone
To log into MariaDBwithout having to have a user account created
Them. This isintended only for testing, and to make the installation
Go a bit smoother. You shoshould remove them before moving into
Productionenvironment.
Remove anonymoususers? [Y/n] y
... Success!
Normally, rootshoshould only be allowed to connect from 'localhost'. This
Ensures that someonecannot guess at the root password from the network.
Disallow root loginremotely? [Y/n] y
... Success!
By default, MariaDBcomes with a database named 'test' that anyone can
Access. This isalso intended only for testing, and shocould be removed
Before moving into aproduction environment.
Remove test databaseand access to it? [Y/n] n
... Skipping.
Reloading theprivilege tables will ensure that all changes made so far
Will take effectimmediately.
Reload privilegetables now? [Y/n] y
... Success!
Cleaning up...
All done! If you 'vecompleted all of the above steps, your MariaDB
Installation shouldnow be secure.
Thanks for usingMariaDB!
[Root @ localhost ~] #
[Root @ localhost ~] # Service mysqld restart
Shutting downMySQL... SUCCESS!
Starting MySQL. SUCCESS!
[Root @ localhost ~] # Mysql-u root-p
Enter password:
Welcome to theMariaDB monitor. Commands end with; or \ g.
Your MariaDBconnection id is 5
Server version: 10.0.19-MariaDB-log Source distribution
Copyright (c) 2000,2015, Oracle, MariaDB Corporation AB and others.
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
MariaDB [(none)]> show tables
->;
ERROR 1046 (3D000): No database selected
MariaDB [(none)]> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Performance_schema |
| Test |
+ -------------------- +
4 rows in set (0.04sec)
MariaDB [(none)]> // create a test database connection
MariaDB [(none)]> create database r_test;
Query OK, 1 rowaffected (0.01 sec)
MariaDB [(none)]> grant all privileges on r_test. * to 'r _ test' @ 'localhost' identifiedby 'r _ test ';
Query OK, 0 rowsaffected (0.00 sec)
MariaDB [(none)]> grant all privileges on r_test. * to 'r _ test' @ '% 'identified by 'r _ test ';
Query OK, 0 rowsaffected (0.00 sec)
Connect with navicat
For installation methods, refer:
Http://www.linuxidc.com/Linux/2014-11/109049.htm