Centos 6.9 binary installation mariadb 5.5.57

Source: Internet
Author: User

Centos 6.9 binary installation mariadb 5.5.57
1. check whether there is any mysql. If yes, the dependency is found during uninstallation. Therefore, ignore the dependency on rpm-qa mysql *
Rpm-e mysql-server-nodeps
Rpm-e mysql-nodeps
Rpm-e mysql-libs-nodeps
The result is that only mysql is deleted, and other software that is dependent on it will not be deleted, but these software cannot run because mysql is not in the system, this is called "not deleted clean.
For example, yum-y remove httpd is used to delete all software dependent on httpd. Such as php and mod_ssl. This is clean.
2. getent passwd mysql found that this user already exists, so you do not need to create another user.
Mysql: x: 27: 27: MySQL Server:/var/lib/mysql:/bin/bash Note:/var/lib/mysql is the folder for storing databases in the future, /bin/bash is the logon shell of mysql.
Rz mariadb-5.5.57-linux-x86_64.tar.gz (self-downloaded package)
3, tar xvf mariadb-5.5.57-linux-x86_64.tar.gz-C/usr/local/(-C/usr/local/this location is defined in advance, where there is a requirement, can not casually put) however, this is not enough. The directory name must be mysql. Therefore, we have made a soft link and can also be renamed directly (in short, we want it to be placed in the mysql folder)
Ln-s mariadb-5.5.57-linux-x86_64/mysql
[Root @ CentOS6 local] # cd mysql/
Ls. It is a compiled binary program.
Next let's see if there are any mysql users. because mysql has been installed in system 6, mysql users have been created in system 6, which is different from that in system 7.
Getent passwd mysql check mysql users
Mysql: x: 27: 27: MySQL Server:/var/lib/mysql:/bin/bash: You can change the Home Directory of mysql and log on to the shell.
Next we need to prepare the mysql configuration file. Now we just decompress the package (these configuration files are in/usr/local/masql/support-files ), we need to copy it to the specified directory. The specified directory is/etc/mysql/. We need to create it ourselves.
4 cd/usr/local/mysql/
Mkdir/etc/mysql/
Cp support-files/my-huge.cnf (not necessarily this file, you can choose one, we are here to choose this experiment)/etc/mysql/my. cnf
We copied the configuration file and renamed it/etc/mysql/my. cnf. The configuration file does not know the storage path of our database, so now we need to modify the configuration file content.
Vim/etc/mysql/my. cnf
[Mysqld]
Datadir =/var/lib/mysql this line must have
Innodb_file_per_table = on
Skip_name_resolve = on
5, after the configuration file is modified, another problem is that there is a system database mysql under/usr/local/, but there is no mysql file in our database storage location/var/lib /., therefore, you do not need to create one by yourself. The system has provided a script to help you create it. The script is in/usr/local/mysql and you can execute the following command:
[Root @ CentOS6 mysql] # scripts/mysql_install_db-user = mysql-datadir =/var/lib/mysql
Now you need to start the service script. There is also a ready-made service script, which is directly copied and put into the specified directory (/etc/init. d) and renamed as mysqld.
6 cp support-files/mysql. server/etc/init. d/mysqld
Chkconfig-list mysqld
Chkconfig-add mysqld
Service mysqld start. Sometimes the service fails to start. If the failure prompts that no log file exists, you can create a log file at this time, the method is mkdir/var/log/mariadb/first create this directory chown mysql/var/log/mariadb/modify the owner service mysqld start to enable the service)
When we started the service successfully on the 6th, we didn't do the above step.
Ss-ntl found that port 3306 has been enabled
7. Now you can use the mysql command, but the command is not found because the path has not been changed. mysql was originally in the bin
So the PATH is changed to PATH =/usr/local/mysql/bin: $ PATH
./Etc/profile. d/mysql. sh takes effect
8, mysql_secure_installation
9, mysql-uroot-p

Supplement: Solution for the Access denied for user 'root' @ 'localhost' (using password: YES) Error
Two days ago, mariadb was successfully installed and logged on, however, after mysql-uroot-p is started up today, mysql cannot be logged on, and an error such as Access denied for user 'root' @ 'localhost' (using password: YES) is prompted, at first, I didn't know what was going on. After a long time, I remembered that I had executed a command to change the password of the root user that day. So the above problem was caused by the user name and password, I have seen some online saying that there is no authorization or anything, and the solution also needs to authorize users. I want to say how to authorize users if they cannot log on to the website, the correct solution is to edit my under/etc/mysql. add a line of skip-grant-tables = on to the cnf configuration file and restart the server [root @ centos7/etc/mysql] # systemctl restart mysql, in this way, when you use mysql-uroot, you do not need to enter the password. After logging on, you cannot set or change the password for the user.

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.