当前位置:网站首页>Mysql database installation
Mysql database installation
2022-07-19 02:47:00 【For whom do the stars change】
MySQL Build and install
(1) preparation
To avoid port conflicts 、 Program conflicts , First query MySQL The installation of the software , If there is MySQL It is recommended to uninstall
rpm -q mysql-server mysql ( View installed rpm package )
rpm -e mysql-server mysql ( uninstall )
(2) install MySQL( mount 1611 Compact disc )
mount /dev/cdrom /media/ ( mount )
cd /media/Packages/ ( Enter the installation directory )
rpm -ivh ncurses-devel-5.9-13.20130511.el7.x86_64.rpm ( install ncurses、MySQL software package )(3)MySQL5.X The series version requires cmake Compilation and installation , So install it first cmake package
mount /dev/cdrom /media/ ( mount MySQL Compact disc )
cd /media/ ( Go to the mount Directory )
tar zxf cmake-2.8.6.tar.gz -C /usr/src ( Unzip to directory )
cd /usr/src/cmake-2.8.6/ ( Entry directory )
./configure ( compile )
gmake && gmake install
(4) Create a running account ( user name mysql) This user does not need to log in to the system directly , You can not create a host folder .
groupadd mysql ( Create grouping )
useradd -M -s /sbin/nologin mysql -g mysql(5) Unpack the downloaded mysql Source package decompression , Release to /usr/src Under the table of contents , And switch to the expanded source directory
cd /media/ ( Entry directory )
tar zxf mysql-5.6.36.tar.gz -C /usr/src/ ( Unpack )(6) To configure
cd /usr/src/mysql-5.6.36 ( Entry directory )
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all ( configuration option )
( It is recommended to copy paragraph by paragraph )
make && make install ( Compile and install )
( The installation process is slow ....) -DCMAKE_INSTALL_PREFIX: Specify the MySQL The database program is installed in a directory .
-DSYSCONFDIR: Specify the initialization parameter file directory .
-DDEFAULT_CHARSET: Specifies the default character set encoding , Such as utf One 8.
-DDEFAULT_COLLATION: Specifies the character set collation rules to be used by default ,utf8_general__ci Is applicable to utf-8 General rules for character sets .
-DWITH_EXTRA_CHARSETS: Specifies additional character set encodings that are supported .
(7) Set permissions on database directory
chown -R mysql:mysql /usr/local/mysql(8) The original my.cnf Replace file with MySQl The content of the configuration file provided ,CentOS7 The system supports by default MariaDB database
rm -rf /etc/my.cnf ( Delete the original MariaDB database )
cp support-files/my-default.cnf /etc/my.cnf ( take MariaDB Replace the database with MySQL database )(9 ) Initialize the database for normal use MySQL Database system , It should be run by the user mysql Execute the initialization script as mysql_install_db, Specify data storage directory, etc .
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/(10) Set environment variables for convenience in any directory mysql command , Need to be in /etc/profile Set the environment variable
echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
. /etc/profile ( Immediate effect )(11) add to MySQL system service
cp support-files/mysql.server /usr/local/mysql/bin/mysqld.sh ( take mysql.server Script files , Copy it to /usr/local/,mysq/bin/ Catalog )
chmod +x /usr/local/mysql/bin/mysqld.sh ( Set executable permissions )
vim /usr/lib/systemd/system/mysqld.service ( open MySQL Master profile )
( The following is for editing )
[Unit]
Description=MySQL Server
After=network.target
[Service]
User=mysql
Group=mysql
Type=forking
PIDFile=/usr/local/mysql/data/ Host name .pid
ExecStart=/usr/local/mysql/bin/mysqld.sh start
ExecStop=/usr/local/mysql/bin/mysqld.sh stop
[Install]
WantedBy=multi-user.target
(10) start-up MySQL service
systemctl start mysqld ( start-up SQL service )
systemctl enable mysqld ( Boot from boot SQL service )
systemctl restart mysqld ( restart SQL service )
systemctl status mysqld ( see SQL service )
netstat -anpt | grep mysqld ( View port number )(11) Sign in MySQL Console
mysql -u root ( No password to log in )
mysql -u root -p ( Login with password )
(12) modify MySQL User password
mysqladmin -u -root password New password ( Create a password when there is no password )
mysqladmin -u -root -p password New password ( Change when there is a password )
( You will be prompted for the old password )
边栏推荐
- Method of JMeter connecting to database
- Next array - circular section
- MySQL数据库安装
- Performance traffic playback
- Gzip的动态压缩和静态压缩详解
- HCIA_NAT实验
- Understand HTTP cache in 30 minutes
- Zabbix6.0通过iDRAC,IMM2监控DELL,IBM服务器硬件
- Subnet division (see details)
- After unity imports the FBX model, the rotation and position of the object will change automatically at runtime
猜你喜欢

Swagger -- the most popular API framework in the world

通过Xshell7使用rz,sz命令上传下载文件

Inverse yuan (I'll add these words if there are too many people using the name)

Metersphere is based on JMeter distributed performance pressure testing platform

Use JMeter to test services based on websocket protocol

三层交换机配置VLAN和使用OSPF协议

多层数据包结构及TCP三次握手
![[solved] after referring to the local MySQL and forgetting the password, [server] --initialize specified but the data directory has files in it Aborti](/img/a8/2daa2c0d834f1986c8421bf5138c7e.png)
[solved] after referring to the local MySQL and forgetting the password, [server] --initialize specified but the data directory has files in it Aborti

DNS域名解析

Network layer transmission protocol (detailed)
随机推荐
正则表达式
通过Xshell7使用rz,sz命令上传下载文件
The difference between cookies and sessions
数组、冒泡的认识
10.系统安全及应用
[solved] after referring to the local MySQL and forgetting the password, [server] --initialize specified but the data directory has files in it Aborti
NAT综合实验
Gzip的动态压缩和静态压缩详解
Detailed explanation of metauniverse public chain caduceus: a creative platform specially built for metauniverse application
Flask template injection
Circular statements and functions of shell scripts
Various development tools
Use JMeter to test services based on websocket protocol
高质量的子程序
Leetcode 322: coin change - Dynamic Planning
Interpretation of concurrent virtual users, RPS and TPS
[tools] unity quickly starts to make the artifact tilemap of 2D and 2.5D games
Graduation thesis word skills Collection
静态路由综合实验
[Ruiji takeout ⑩] rough learning of Linux & rough learning of redis