1, installation mariadb
Installation commands
Install MARIADB Mariadb-server
Installation Complete mariadb, first start mariadb
Systemctl Start mariadb
Set boot up
Systemctl Enable MARIADB
The following is a simple configuration of mariadb
Mysql_secure_installation
The first is to set the password, you will be prompted to enter the password
Enter current password to root (enter for none): <– First run direct carriage return
Set Password
Set root Password? [y/n] <– whether to set the root user password, enter Y and return or direct enter
New Password: <– Set the root user's password
Re-enter new password: <– Enter the password you set again
Other configurations
Remove anonymous users? [y/n] <– Whether to delete anonymous users, enter
Disallow Root login remotely? [y/n] <– Whether root login is forbidden, enter,
Remove test database and access to it? [y/n] <– Whether to delete the test database, enter
Reload privilege tables now? [y/n] <– whether to reload the permissions table, enter
Initialize MARIADB complete, next Test login
Mysql-uroot-ppassword
Complete.
2. Configuring the MARIADB Character Set
File/etc/my.cnf
Vi/etc/my.cnf
Add under the [Mysqld] tab
init_connect= ' SET collation_connection = Utf8_unicode_ci '
init_connect= ' SET NAMES UTF8 '
Character-set-server=utf8
Collation-server=utf8_unicode_ci
File/etc/my.cnf.d/client.cnf
Vi/etc/my.cnf.d/client.cnf
Add in [client]
Default-character-set=utf8
File/etc/my.cnf.d/mysql-clients.cnf
Vi/etc/my.cnf.d/mysql-clients.cnf
Add in [MySQL]
Default-character-set=utf8
Complete configuration, restart MARIADB
Systemctl Restart MARIADB
Then enter MARIADB to view the character set
Like "%character like"%collation% ";
Displayed as
+--------------------------+----------------------------+
| variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | UTF8 |
| character_set_connection | UTF8 |
| Character_set_database | UTF8 |
| Character_set_filesystem | binary |
| Character_set_results | UTF8 |
| Character_set_server | UTF8 |
| Character_set_system | UTF8 |
| Character_sets_dir | /usr/share/mysql/charsets/|
+--------------------------+----------------------------+
8 rows in Set (0.00 sec)
+----------------------+-----------------+
| variable_name | Value |
+----------------------+-----------------+
| collation_connection | Utf8_unicode_ci |
| Collation_database | Utf8_unicode_ci |
| Collation_server | Utf8_unicode_ci |
+----------------------+-----------------+
3 Rows in Set (0.00 sec)
The character set configuration is complete.
3. Add users, set permissions
Create user command
MySQL>user username'password';
Direct creation of user and authorized commands
MySQL>*. To username'password';
Grant access to the extranet
MySQL>*. to [email protected]'%'password';
Grant permissions and can authorize
MySQL>*. to [email protected]' hostname'passwordoption;
4. Refresh Permissions
Flush privileges;
Simple user and permission configuration is basically the case.
Where only partial permissions are granted to change all privileges or all to Select,insert,update,delete,create,drop,index,alter,grant,references,reload, Shutdown,process,file part of it.
5. Other instructions)
* (1).上面配置字符的过程也适用于windows情况,只不过在window中修改配置文件为"my.ini"; * (2).上面配置字符的过程,如果没有找到需要的client中的配置文件,可以在server的配置文件中添加相应的标签和内容也可以。
6. Completely uninstall and install MySQL under Ubuntu System (other configurations are the same as above)
- (1). Delete MySQL
sudo apt-get autoremove--purge mysql-server-5.0
sudo apt-get remove Mysql-server
sudo apt-get autoremove mysql-server
sudo apt-get remove Mysql-common//This is important
In fact, some of the above is superfluous.
- (2). Clean up residual data
Dpkg-l |grep ^rc|awk ' {print $} ' |sudo Xargs dpkg-p
(3). Install MySQL
sudo apt-get install Mysql-server
sudo apt-get install mysql-client
sudo apt-get install Php5-mysql
Installing Php5-mysql is to connect PHP with MySQL.
Once the installation is complete, the MySQL server should start automatically. You can check whether the MySQL server is running by running the following command at the terminal prompt:
sudo netstat-tap | grep MySQL
When you run the command, you can see a line similar to the following:
tcp 0 0 localhost.localdomain:mysql *:* LISTEN -
If the server does not function correctly, you can start it by using the following command:
Sudo/etc/init.d/mysql restart
Go to MySQL
$mysql-uroot-p Administrator Password
Configure the Administrator password for MySQL:
sudo mysqladmin-u root password newpassword
Linux installation mariadb (MYSQL) and simple configuration