CentOS6.9 installs Mysql5.7 for your reference, the details are as follows 1. Upload the installation package 2. Create users and mysql directories 1. Create a mysql group Enter the command: groupadd mysql 2. Create a mysql user and put it in the mysql group Enter the command: useradd -r -g mysql mysql 3. Set a password for the mysql user Enter the command: passwd mysql 3. Unzip Mysql 1. Copy the tarball to the /usr/local/mysql directory 2. Decompression tar -zxvf mysql.tar 3. Rename the unzipped file to mysql 4. Configure related startup files 1. Copy my_default.cnf to /etc/my.cnf (automatically read when mysql starts) Back up my.cnf Copy my.cnf 2. Solve the garbled problem Enter the command: vi /etc/my.cnf Change: [mysql] default-character-set=utf8 [mysqld] default-storage-engine=INNODB character_set_server=utf8 3. Copy mysql.server to /etc/init.d/ 4. Modify the /etc/init.d/mysql parameters to give two directory locations Enter the command: vim /etc/init.d/mysql Change: basedir=/usr/local/mysql datadir=/usr/local/mysql/data 5. Change the owner of the directory /usr/local/mysql Enter the command: chown -R mysql:mysql /usr/local/mysql/ 5. Initialize the database Old command ./mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ New command: ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 6. Start the database Enter the command: ./mysqld_safe --user=mysql & & symbol: throw the current process to the background 7. Change Password View the password automatically generated by initialization: cat /root/.mysql_secret Enter mysql: bin/mysql -uroot -p (paste the password you just copied) Reset root password after logging in mysql> SET PASSWORD FOR 'root'@localhost = PASSWORD('123456'); 8. Connecting to the virtual machine database on this machine Check whether only root localhost permissions are authorized. If so, remote access cannot connect mysql> select Host, User, Password from mysql.user; Grant % permissions to root mysql> update user set host = '%' where host = 'localhost'; mysql> flush privileges; Finish! IX. Problem 1. ./mysqld_safe: line 586: /var/lib/mysql/mysqld_safe.pid: No such file or directory Solution: (1) Because there is no error log during the investigation, we temporarily use the method of supplementing the directory mkdir -p /var/lib/mysql chown mysql:mysql /var/lib/mysql (2) After adding the directory, the error message Can't open and lock privilege tables: Table 'mysql.user' doesn't exist appears Error in datadir path in My.ini Change path 2.mysqld_safe mysqld from pid file /usr/local/mysql/localhost.pid ended Query log: Found: The error means mysqld does not have the access rights to the directory. Change permissions: chmod -R 777 A new problem occurred: Can't open the mysql.plugin table. Please run mysql_upgrade to create it. Solution: Reinitialize using the old command 3. Starting MySQL..... ERROR! The server quit without updating PID file (/usr/local/mysql/centos6.9.wzy.com.pid). Problem: character_set_server=utf8 is written incorrectly in my.ini When I fixed the problem before, my.ini was changed incorrectly datadir=/usr/local/mysql/data The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: jQuery plugin to implement stacked menu
>>: Summary of methods to check whether the port is open in Linux
Why do we need to summarize the browser compatibi...
To view the version and tag of the image, you nee...
mysql copy one table column to another table Some...
Apple Mug Icons and Extras HD StorageBox – add on...
I would like to quote an article by Zhang Xinxu a...
CSS3 syntax: (1rem = 100px for a 750px design) @m...
background All company websites need to support t...
MAC installs mysql8.0, the specific contents are ...
This article records the installation graphic tut...
Table of contents background Provide / Inject Ext...
View MySQL transaction isolation level mysql> ...
Tutorial Series MySQL series: Basic concepts of M...
The tutorial for installing OpenStack Ussuri with...
Many times, after we install a web service applic...
Overview of MySQL Partitioned Tables As MySQL bec...