Installation Preparation
Mariadb removal
Because CentOS7 comes with a Mariadb, so first to remove him ...
1. Find version
# rpm -qa|grep mariadb
Ghost similar MariaDB-server-5.5.49-1.el7.centos.x86_64 like will appear after executing the command .. remember the names on the list.
2. Delete
Check out # rpm -e --nodeps above the file name
3. Delete Profiles
# rm /etc/my.cnf
Get install package
It directly to the official MySQL Community Server 5.5.62
Select Linux - Generic attention
Push archive
Pushed to the virtual machines or remote server, ftp or rz, or direct graphical interface with drag you, in short, pushed up on the line
start installation
Decompression
Note If unpacked need to consider whether such an error EOF archive file is corrupted
Try replacing the compressed archive or re-push
tar -xvf mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz
Copy to local
mv mysql-5.5.62-linux-glibc2.12-x86_64 /usr/local
Modify Folder
cd /usr/local mv mysql-5.5.62-linux-glibc2.12-x86_64 mysql-5.5.62
Modify the configuration file
we /etc/my.cnf
[mysql] # Mysql client to set the default character set default-character-set=utf8 socket=/var/lib/mysql/mysql.sock [mysqld] skip-name-resolve Set # 3306 Port port = 3306 socket=/var/lib/mysql/mysql.sock # Set the mysql installation directory, the directory must post here if you unpack and change the directory name yo .. basedir=/usr/local/mysql-5.5.62 # Set the data storage directory of mysql database directory here must decompress and after if you change the directory name yo .. datadir=/usr/local/mysql-5.5.62/data # Maximum number of connections allowed max_connections=200 # Server default character set used for the 8-bit coded character set latin1 character-set-server=utf8 The default storage engine that will be used when creating a new table # default-storage-engine=INNODB lower_case_table_name=1 max_allowed_packet=16M
Change directory to the mysql
cd /usr/local/mysql-5.5.62
Adding users and user groups
Note: It should change the directory to the mysql directory is on the step of the operation
groupadd mysql
useradd -g mysql mysql
chown -R mysql:mysql ./
Install mysql
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.5.62/ --datadir=/usr/local/mysql-5.5.62/data/
After the installation of the print will be the following
[root@yangtuo mysql-5.5.62]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.5.62/ --datadir=/usr/local/mysql-5.5.62/data/ Installing MySQL system tables... 190616 17:56:34 [Warning] Using unique option prefix lower_case_table_name instead of lower_case_table_names is deprecated and will be removed in a future release. Please use the full name instead. 190616 17:56:34 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 190616 17:56:34 [Note] /usr/local/mysql-5.5.62//bin/mysqld (mysqld 5.5.62) starting as process 73351 ... OK Filling help tables... 190616 17:56:34 [Warning] Using unique option prefix lower_case_table_name instead of lower_case_table_names is deprecated and will be removed in a future release. Please use the full name instead. 190616 17:56:34 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 190616 17:56:34 [Note] /usr/local/mysql-5.5.62//bin/mysqld (mysqld 5.5.62) starting as process 73359 ... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/local/mysql-5.5.62//bin/mysqladmin -u root password 'new-password' /usr/local/mysql-5.5.62//bin/mysqladmin -u root -h 172.20.10.7 192.168.122.1 password 'new-password' Alternatively you can run: /usr/local/mysql-5.5.62//bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr/local/mysql-5.5.62/ ; /usr/local/mysql-5.5.62//bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/local/mysql-5.5.62//mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/ [root@yangtuo mysql-5.5.62]#
Above this has been successfully installed mysql also need some settings before they can run properly
Installation configuration
Configuring Mysql
chown -R mysql:mysql data chown 777 /etc.my.cnf cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld chmod +x /etc/rc.d/init.d/mysqld chkconfig --add mysqld chkconfig --list mysqld mkdir / have / lib / mysql chmod 777 /var/lib/mysql
Open service
service mysqld start
Setting PATH
vi ~ / .bash_profile
Join in the final surface the following file, and use: wq save
export PATH=$PATH:/usr/local/mysql-5.5.62/bin
Refresh PATH
source ~/.bash_profile
Above normal operation is complete you can either use mysql, in order to facilitate the use of the latter, we have already carried out some optimization settings security settings, etc.
The basic set up and use mysql
Log in mysql
At this time there is no mysql password, when there Enter password: Enter directly
mysql -uroot -p
Changing the root password
mysql> use mysql MySQL > Update User SET password = password ( ' password to be set ' ) WHERE User = ' the root ' and Host = ' localhost ' ; mysql> flush privileges;
Configure Remote Login
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '刚才设置的root密码' WITH GRANT OPTION;
到此所有配置全部完毕. 可以使用远程工具进行登录了