Linux (redhat) server configuration, chapter 1: mysql installation

I have been working on a linux (redhat) server recently. Since I have not used a linux system before, I recorded the ideas for solving the problems encountered in the operation steps for future reference; this article is for the [linux (redhat) server configuration] series The first chapter of the article.

1. Download the mysql installation package (rpm)

        There are a lot of online resources, so I can download them on my own. There are three packages: MySQL-client-5.5.28-1.linux2.6.x86_64.rpm, MySQL-devel-5.5.28-1.linux2.6.x86_64.rpm, MySQL-server-5.5.28-1.linux2.6.x86_64.rpm

2. Install mysql

       2.1) First check whether the server has deployed mysql, use the command: find / -name mysql, if so, uninstall it first. Uninstall command: yum -y remove mariadb-libs-1:5.5.35-3.el7.x86_64. Generally, the newly installed server has the mariadb-libs package, so uninstall it first.

       2.2) Install mysql I perform a simple installation, first enter the rpm directory location (cd /home/...); then use the command: rpm -ivh MySQL-client-5.5.28-1.linux2.6.x86_64.rpm
, -Ivh MySQL-devel-5.5.28-1.linux2.6.x86_64.rpm, rpm -ivh MySQL-server-5.5.28-1.linux2.6.x86_64.rpm, after the installation is complete, proceed to the MySQL ROOT account password setting.

       2.3) To set the database password, first enter mysql through the command: mysql -uroot -p, then use the command to switch the database: use mysql, and finally execute the following statement:

UPDATE user SET password=PASSWORD("数据密码") WHERE user='root';
If you need to restrict the ip address to log in to the database, you can execute the following command:

insert into user(host,user,password) values('10.221.199.1','root',password('数据库密码'));
grant all privileges on *.* to root@"10.221.199.1";
3. Copy the mysql configuration file to etc

Use the command:

cp /usr/share/doc/MySQL-server-5.5.28/my-large.cnf /etc/my.cnf

If you want to modify the mysql port, use the command to open my.cnf: vim my.cnf and edit directly; if you want to limit the case sensitivity of the table, add a line under mysqld: lower_case_table_names=1

4. Restart mysql, use the command: service mysql restart.
Complete! ! ! ! ! ! ! ! ! ! ! ! !

Guess you like

Origin blog.csdn.net/nanxiaotiantian/article/details/54603295