Tag: encoding requires status names ISP line to create white server
Installing MySQL on your own CentOS server today is a lot more problematic, and it's much more complex to install MySQL than in Windows. Here's a look at some of the blog posts (including the previous ones) to record the various problems when installing MySQL. The steps may be incomplete, and the installation is messy, but the general steps are there. Other problems encountered by Baidu should be able to search. 1. Prepare MySQL installation files
Download the mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz, unzip it and put it in the directory you want to install, or create a soft link. In this example, the extract is renamed as:/opt/mysql and then into the directory:
# Cd/opt/mysql
2. Create a data storage directory, such as
#mkdir/opt/mysql/data
3. Create MySQL Users and groups
-r-g mysql-s/bin/false-R root:root/opt/mysql
4. Initialize the database
# bin/mysqld--initialize--user=mysql--basedir=/opt/mysql--datadir=/opt/mysql/data# bin/mysql_ssl_rsa_ Setup--datadir=/opt/mysql/-R mysql:mysql/opt/mysql
5. Create configuration file My.cnf
#cp support-files/my-default. cnf./My.cnf#vim my.cnf
The general content is as follows, modify as needed:
[Client]default-character-Set=Utf8mb4[mysql]default-character-Set=Utf8mb4[mysqld]character-Set-server=utf8mb4# version 5.6. 19 This sentence must be set in order for the encoding set in the [client] to be valid character-Set-client-handshake =falsecollation-server=utf8mb4_unicode_ci# table names are case-sensitive: 1 is case-insensitive, 2 means Lower_case_table_names=1Basedir=/opt/Mysqldatadir=/opt/mysql/dataport=3306Socket=/tmp/mysql.sock
6. Add MySQL Service
#cp Support-files/mysql.server/etc/init.d/mysql
7. Add Boot MySQL Service
#chkconfig--2345 MySQL on
8. Start-Stop MySQL service
#service MySQL Start|stop|restart|status
9. Log in to MySQL
#bin/mysql-uroot-p
The first time you log in, the root user's password will generate a random password when the database is initialized in the fourth step, and you can enter it here. Password change required after login:
Mysql>set'yourpassword';
For convenience, you can add a soft link to the/opt/mysql/bin/mysql to the/var/bin so that you can use the MySQL command under any path:
#ln-fs/opt/mysql/bin/mysql/usr/bin/mysql
Installing MySQL5.7 using a compressed package under CentOS