Home > Database > Mysql Tutorial > body text

Build mysql server on linux system

王林
Release: 2020-06-10 09:28:32
forward
3020 people have browsed it

Build mysql server on linux system

1. Download the mysql installation package from the official website

The following picture is an introduction to the mysql installation package

Build mysql server on linux system

2 , Install software package

1, Install dependencies

# yum -y install perl-Date-Dumper perl-JSON perl-Time-HiRes
Copy after login

2, Unzip the mysql installation package

# tar -xvf mysql-5.7.24.tar               //解压mysql包
Copy after login

3, Uninstall the old version of the package

[root@localhost ~]# rm -rf /etc/my.cnf
Copy after login

4, Delete data

[root@localhost ~]# rm -rf /var/lib/mysql/*
Copy after login

5. Uninstall the software package (no software package will be displayed as uninstalled)

[root@localhost ~]# rpm -e --nodeps mariadb-server mariadb
Copy after login

Warning: /var/log/mariadb/mariadb.log has been saved as /var /log/mariadb/mariadb.log.rpmsave

#yum -y remove mariadb-libs.x86_64 1:5.5.52-1.el7
Copy after login

6. Install yum source

#yum -y install mysql-community-client mysql-community-common mysql-community-devel mysql-community-embedded mysql-community-embedded-compat mysql-community-embedded-devel  mysql-community-libs mysql-community-libs-compat mysql-community-minimal-debuginfo mysql-community-server mysql-community-test
Copy after login

or

#yum -y install mysql-community-*.rpm
Copy after login

7. Check the installed mysql related installation package

# rpm -qa | grep -y mysql
Copy after login

8. Start the service

# systemctl start mysqld
# systemctl enable mysqld //设置开机自启
# systemctl status mysqld
[root@proxy mysql]# ss -antulp | grep mysqld //查看服务启动端口
# ps aux | grep mysqld //查进程
Copy after login

3. Connect to the database

1. Check the randomly generated root password

# grep password /var/log/mysqld.log
#  grep 'temporary password' /var/log/mysqld.log //随机生成的管理密码
Copy after login

Initial password login mysql:

(!!!You must change the password management immediately when logging in with a randomly generated password, otherwise an error will be reported)

2. Client command mysql to connect to the database

# mysql -hlocalhost -uroot -p'pIhMu,i2OS#,' //用初始密码登录
mysql> \h //登录成功后,查可用的快捷键
Copy after login

4. Change the password

1. You can only modify the password first

mysql> alter user root@"localhost" identified by "123qqq...A";
Copy after login

2. You can modify the password limit length

mysql> show variables like "%password%";              //查询密码有关的变量
mysql> set global validate_password_policy=0;       //只验证长度
mysql> set global validate_password_length=6;      //修改密码长度为6位
mysql> alter user root@"localhost" identified by "123456";             //修改root密码为123456
Copy after login

Recommended tutorial: mysql tutorial

The above is the detailed content of Build mysql server on linux system. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template