当前位置:网站首页>Four ways to install MySQL in Linux
Four ways to install MySQL in Linux
2022-06-13 08:16:00 【BT youth】
Source code installation MySQL:
1. Install development tools and packages
yum install make gcc gcc-c++ cmake bison-devel ncurses-devel
yum install libaio libaio-devel openssl-devel
yum install perl-Data-Dumper
yum install net-tools
2. decompression
tar xvf mysql-boost-5.7.14.tar.gz -C /ruanjian/mysql
( First create mysql Folder )
3. Create users and groups
groupadd -r -g 306 mysql
useradd -g 306 -r -u 306 mysql
4.
cmake -DCMAKE_INSTALL_PREFIX=/ruanjian/mysql -DMYSQL_DATADIR=/ruanjian/mysql/data -DDEFAULT_CHARSET=utf8 DDEFAULT_COLLATION=utf8_general_ci -DWITH_BOOST=/ruanjian/mysql/mysql-7.5/boost/
( Configure in the unzipped package )
5. Compilation and installation
[[email protected] mysql-5.7.14]# make && make install
6. initialization
/ruanjian/mysql/bin/mysqld --initialize --user=mysql -datadir=/ruanjian/mysql/data --basedir=/ruanjian/mysql/
7. by mysql Provide the master configuration file
cd /usr/local/mysql/
\cp support-files/my-default.cnf /etc/my.cnf
vim /etc/my.cnf
Add the following line to specify mysql The location of the data file :
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
8. by mysql Provide sysv Service script
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
9. Configure environment variables
vim /etc/profile.d/mysql.sh
export PATH=$PATH:/usr/local/mysql/bin
source mysql.sh
10. start-up MySQL
11. Configure a password
Use security plug-ins : mysql_sevure_installation
Get into MySQL terminal : ALTER USER 'root'@'localhost' IDENTIFIED BY 'MySQL';
If you make a mistake , The password is too short ,MySQL No authentication succeeded
Modify the authentication rules :
set global validate_password_policy=0;
set global validate_password_length=1;
Binary installation MySQL:
1. newly build MySQL Users and groups ( There is no need to create groups )
groupadd -r -g 306 mysql
useradd -g 306 -r -u 306 mysql
2. Unzip the file
3. install MySQL tar xvf mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz
4. Create virtual connection ln -sv mysql-5.7.14-linux-glibc2.5-x86_64 mysql
5. change MySQL The group to which the belongs chown -R mysql.mysql mysql/*( You can leave it blank )
6. initialization mysql/bin/mysqld --initialize --user=mysql --basedir=/ruanjian/mysql -datadir=/ruanjian/mysql/data
7. Set up profiles and provide sysv Service script ( must CD To /ruanjian/mysql Catalog )
\cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
vim /etc/my.cnf
Add the following line to specify mysql The location of the data file :
basedir = /ruanjian/mysql
datadir = /ruanjian/mysql/data
port = 3306
notes : May come across mysql.sock Can't find , therefore Set up
socket=/var/lib/mysql/mysql.sock --- solve mysq.sock No problem found
skip-grant-tables -- Setting startup does not require a password
No need to enter the password mysql Modify the expired password permission later
update mysql.user set password_expired='N';
Then enter /etc/my.cnf Note out skip-grant-tables,
Enter with the initial password that will do Change Password
see mysqld Whether there is Execution Authority Add execute permission :chmod +x /etc/rc.d/init.d/mysqld
8. start-up MySQL
chkconfig --add mysqld -- Add as system service
chkconfig mysqld on -- Boot up ( Not set up )
systemctl start mysqld start-up MySQL
9. Configure environment variables
cd /etc/profile.d/ # vim mysql.sh
Add the following :export PATH=$PATH:/ruanjian/mysql/bin
source mysql.sh
10. Configure a password ( ditto )
Use security plug-ins : mysql_sevure_installation
Get into MySQL terminal : ALTER USER 'root'@'localhost' IDENTIFIED BY 'MySQL';
If you make a mistake , The password is too short ,MySQL No authentication succeeded
Modify the authentication rules :
set global validate_password_policy=0;
set global validate_password_length=1;
yum install MySQL:
1. To configure yum Source
2. install MySQL yum install mysql-server mysql-client
If an error is reported : software package :akonadi-mysql-1.9.2-4.el7.x86_64 (@anaconda) need :mariadb-server Deleting : 1:mariadb-server-5.5.60-1.el7_5.x86_64 (@anaconda) mariadb-server = 1:5.5.60-1.el7_5 replace , from : mysql-community-server-5.6.44-2.el7.x86_64 (mysql56-community) Not found
You need to yum -y remove mariadb-libs To cancel mariadb Dependency of
3. start-up MySQL systemctl start mysqld
4. View random password grep 'temporary password' /var/log/mysqld.log
Or use a security plug-in : mysql_sevure_installation The first random password can be left blank , Press enter to change the password
5. The first time you log in, change your password
Get into MySQL terminal : ALTER USER 'root'@'localhost' IDENTIFIED BY 'MySQL';
If you make a mistake , The password is too short ,MySQL No authentication succeeded
Modify the authentication rules :
set global validate_password_policy=0;
set global validate_password_length=1;
The location of the configuration file : /etc/mysql/mysql.conf.d/mysqld.cnf
rpm install MySQL:
1. Unzip the installation package tar xvf
2. Delete mariadb-libs
3. Installation depends on net-tools
4. install MySQL
rpm -ivh mysql-community-client-5.7.14-1.el7.x86_64.rpm
mysql-community-common-5.7.14-1.el7.x86_64.rpm
mysql-community-libs-5.7.141.el7.x86_64.rpm
mysql-community-server-5.7.14-1.el7.x86_64.rpm
5. start-up MySQL systemctl start mysqld
6. Configure a password ( ditto )
Use security plug-ins : mysql_sevure_installation
Get into MySQL terminal : ALTER USER 'root'@'localhost' IDENTIFIED BY 'MySQL';
If you make a mistake , The password is too short ,MySQL No authentication succeeded
Modify the authentication rules :
set global validate_password_policy=0;
set global validate_password_length=1;
边栏推荐
- Go 接口实现原理【高阶篇】: type _interface struct
- mysql面试题
- Practice makes sense -- your byte alignment and stack cognition may be wrong
- CCNP_ BT-MGRE
- Altium Designer中导入和导出设置的方法
- SolidWorks修改工程图中文字字体的方法
- Did decentralized digital identity
- 5. fabric2.2 installation and submission contract (using official demo)
- ERP basic data Kingdee
- 2022年电工(初级)考题及模拟考试
猜你喜欢
Effective Go - The Go Programming Language
22 | adventure and prediction (I): hazard is both "danger" and "opportunity"
ERP basic data Kingdee
20 | pipeline oriented instruction design (Part 1): Modern CPU with multi-purpose
What software can be used to solve the problems faced by the auto parts industry
How can the small and medium-sized lighting industry make use of the digital transformation to stand out from the encirclement?
Overview of cross chain protocol IBC
本地靶场2-文件上传漏洞(三)-网络安全
IIS中的网站访问excel
[game theory complete information static game] Application of Nash equilibrium
随机推荐
AcWing 1977. Information relay (base ring tree, parallel search set)
What software can be used to solve the problems faced by the auto parts industry
Plane merging (matlab)
Dfinity (ICP) basic development tutorial-5
How about a well-known food material distribution information management system?
ES6 deleting an attribute of an object
2022年电工(初级)考题及模拟考试
17. how to understand multi version concurrency control and read / write sets of fabric smart contracts? (vernacular version)
酒水批发行业应当如何高效管理商品与库存
19 | establish data path (bottom): instruction + operation =cpu
Live broadcast review | bas technology innovation exploration under active defense system
How to efficiently manage commodities and inventory in the beverage wholesale industry
适合生鲜批发行业的几种精准接单方式
Methods of importing and exporting settings in Altium Designer
钉钉小程序 父子传参数对象 子组件页面不更新?
Install cuda+cusp environment and create the first helloword starter project
CCNP_ Bt-ospf big experiment (1)
疫情之下的远程办公解决方案
Gtk+ programming example on page 115 - simplest progress bar 2 with steps to write GTK program using anjuta
关于redis使用分布式锁的封装工具类