1: Is there an older version of mysql view under linux (have deleted)
Find old mysql: rpm -qa | grep mysql
Uninstall: uninstall command: rpm -ev {package name} -: rpm -ev mysql-community-common-5.7.23-1.el7.x86_64
Find the old version of mysql related to the installation directory command: find / -name mysql
If it can find the relevant directory using the command: rm -rf {directory name}: Remove directory
2: Check whether the installation under linux mariadb database (any need to remove, because there is a conflict)
Check whether the installation mariadb: rpm -qamariadb | grep
Delete mariadb: rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64
3: Create mysql storage directory (/ root / software)
Create a folder: mkdir / root / software
Extract to the current folder, and extract the files to a designated folder and repair the folder name:
Decompression: tar -xzvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
Move and change the name: mv mysql-5.7.24-linux-glibc2.12-x86_64 / usr / local / mysql
4: Create a home directory (data: storage directory)
Create a home directory: mkdir / usr / local / mysql / data
5: Main directory permissions process (see if you have users, delete and create a new user)
View user and group situations: cat / etc / group | grep mysql
view group and user situations: cat / etc / passwd | grep mysql
If there is, then delete the original mysql user: userdel -r mysql, deletes the corresponding groups and users and view at times.
Create a mysql group: groupadd mysql
create mysql user: useradd -r -g mysql mysql
modify the directory owner: chown -R mysql: mysql / usr / local / mysql
6: create a profile and related directories (if the path already exists in this case would not have created)
Create a configuration file: vim /etc/my.cnf
File template:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It‘s a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
Modify the configuration file: Note to be to modify the [mysqld] the following template (basedir: mysql installation path, datadir: data storage directory)
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port = 3306
socket=/tmp/mysql.sock
pid-file=/tmp/mysqld/mysqld.pid
character-set-server = utf8
log-error=/var/log/mysqld.log
Save and exit: wq!
Create a file /tmp/mysql.sock: Setting up user groups and user authorization
cd /tmp
touch mysql.sock
chown mysql:mysql mysql.sock
chmod 755 mysql.sock
Create a file /tmp/mysqld/mysqld.pid
mkdir mysqld
cd mysqld
touch mysqld.pid
cd ..
chown -R mysql:mysql mysqld
cd mysqld
chmod 755 mysqld.pid
Create a file /var/log/mysqld.log:
touch /var/log/mysqld.log
chown -R mysql:mysql /var/log
cd /var/log
chmod 755 mysqld.log
7: Install and initialize the database
Enter initialization directory: cd / usr / local / mysql / bin /
Database Initialization: ./ mysqld --initialize --user = mysql --basedir = / usr / local / mysql - datadir = / usr / local / mysql / data
如果报错:(./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory)
You need to install the command: yum -y install numactl
After initialization is performed in a database: ./ mysqld --initialize --user = mysql --basedir = / usr / local / mysql - datadir = / usr / local / mysql / data
8: Safe boot:
./mysqld_safe --user=mysql &
After enter into the bin directory
View success: ps -ef | grep mysql
The default password mysqld.log log, save after finding a safe place: cat /var/log/mysqld.log
Which root @ localhost: the default password is behind the back log in (D; J.ogLj8ETr)
Go to the bin directory:
cd /usr/local/mysql/bin/
Login mysql:
./mysql -u root -p
However, if the input related commands, you will be prompted to modify user password (note must be added later;).
show databases;
Password changed to aaa
mysql> set password=password("aaa");
9: Set up remote access permissions (set in mysql inside)
mysql>grant all privileges on *.* to 'root'@'%' identified by 'aaa';
Refresh login permissions:
mysql> flush privileges;
Quit quit or exit
mysql> quit;
10: Power service startup settings:
The support-files / mysql.server copy of /etc/init.d/mysql:
Command: cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
To see if the success :( named mysql)
cd /etc/init.d/
ll
See if mysql service in the service configuration
chkconfig --list mysql
If not, put mysql registered for the start-up of the service, and then conducting View
chkconfig --add mysql
chkconfig --list mysql
Start or stop
service mysql start
service mysql stop
11: Create a shortcut:
service startup, run directly mysql -u root -p to log in, do not need to enter the corresponding directory.
ln -s /usr/local/mysql/bin/mysql /usr/bin
12: occurs when connecting to the database using Navicat (2003)
show that you are not related to the firewall.
solution:
// temporary closure systemctl stop firewalld
// Disable boot
systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
1: Is there an older version of mysql view under linux (have deleted)
Find old mysql: rpm -qa | grep mysql
Uninstall: uninstall command: rpm -ev {package name} -: rpm -ev mysql-community-common-5.7.23-1.el7.x86_64
Find the old version of mysql related to the installation directory command: find / -name mysql
If it can find the relevant directory using the command: rm -rf {directory name}: Remove directory
2: Check whether the installation under linux mariadb database (any need to remove, because there is a conflict)
Check whether the installation mariadb: rpm -qamariadb | grep
Delete mariadb: rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64
3: Create mysql storage directory (/ root / software)
Create a folder: mkdir / root / software
Extract to the current folder, and extract the files to a designated folder and repair the folder name:
Decompression: tar -xzvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
Move and change the name: mv mysql-5.7.24-linux-glibc2.12-x86_64 / usr / local / mysql
4: Create a home directory (data: storage directory)
Create a home directory: mkdir / usr / local / mysql / data
5: Main directory permissions process (see if you have users, delete and create a new user)
View user and group situations: cat / etc / group | grep mysql
view group and user situations: cat / etc / passwd | grep mysql
If there is, then delete the original mysql user: userdel -r mysql, deletes the corresponding groups and users and view at times.
Create a mysql group: groupadd mysql
create mysql user: useradd -r -g mysql mysql
modify the directory owner: chown -R mysql: mysql / usr / local / mysql
6: create a profile and related directories (if the path already exists in this case would not have created)
Create a configuration file: vim /etc/my.cnf
File template:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It‘s a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
Modify the configuration file: Note to be to modify the [mysqld] the following template (basedir: mysql installation path, datadir: data storage directory)
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port = 3306
socket=/tmp/mysql.sock
pid-file=/tmp/mysqld/mysqld.pid
character-set-server = utf8
log-error=/var/log/mysqld.log
Save and exit: wq!
Create a file /tmp/mysql.sock: Setting up user groups and user authorization
cd /tmp
touch mysql.sock
chown mysql:mysql mysql.sock
chmod 755 mysql.sock
Create a file /tmp/mysqld/mysqld.pid
mkdir mysqld
cd mysqld
touch mysqld.pid
cd ..
chown -R mysql:mysql mysqld
cd mysqld
chmod 755 mysqld.pid
Create a file /var/log/mysqld.log:
touch /var/log/mysqld.log
chown -R mysql:mysql /var/log
cd /var/log
chmod 755 mysqld.log
7: Install and initialize the database
Enter initialization directory: cd / usr / local / mysql / bin /
Database Initialization: ./ mysqld --initialize --user = mysql --basedir = / usr / local / mysql - datadir = / usr / local / mysql / data
如果报错:(./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory)
You need to install the command: yum -y install numactl
After initialization is performed in a database: ./ mysqld --initialize --user = mysql --basedir = / usr / local / mysql - datadir = / usr / local / mysql / data
8: Safe boot:
./mysqld_safe --user=mysql &
After enter into the bin directory
View success: ps -ef | grep mysql
The default password mysqld.log log, save after finding a safe place: cat /var/log/mysqld.log
Which root @ localhost: the default password is behind the back log in (D; J.ogLj8ETr)
Go to the bin directory:
cd /usr/local/mysql/bin/
Login mysql:
./mysql -u root -p
However, if the input related commands, you will be prompted to modify user password (note must be added later;).
show databases;
Password changed to aaa
mysql> set password=password("aaa");
9: Set up remote access permissions (set in mysql inside)
mysql>grant all privileges on *.* to 'root'@'%' identified by 'aaa';
Refresh login permissions:
mysql> flush privileges;
Quit quit or exit
mysql> quit;
10: Power service startup settings:
The support-files / mysql.server copy of /etc/init.d/mysql:
Command: cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
To see if the success :( named mysql)
cd /etc/init.d/
ll
See if mysql service in the service configuration
chkconfig --list mysql
If not, put mysql registered for the start-up of the service, and then conducting View
chkconfig --add mysql
chkconfig --list mysql
Start or stop
service mysql start
service mysql stop
11: Create a shortcut:
service startup, run directly mysql -u root -p to log in, do not need to enter the corresponding directory.
ln -s /usr/local/mysql/bin/mysql /usr/bin
12: occurs when connecting to the database using Navicat (2003)
show that you are not related to the firewall.
solution:
// temporary closure systemctl stop firewalld
// Disable boot
systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.