In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The problems encountered during installation are:
1. My-default.cnf file cannot be found
2. Mysql starts the error report
3. Mysql temporary password cannot log in.
Installation environment centos 6. 0
Download the database:
[root@CLanguage src] # pwd
/ usr/local/src # download file storage path (for personal reasons, feel free. )
[root@CLanguage src] #
Wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
[root@CLanguage src] # tar-zxvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz # decompress
[root@CLanguage src] # mv mysql-5.7.21-linux-glibc2.12-x86_64 mysql
# change the file name
Uninstall the old version:
[root@CLanguage src] # rpm-qa | grep mysql
Mysql-5.1.47-4.el6.x86_64
Mysql-libs-5.1.47-4.el6.x86_64
Mysql-devel-5.1.47-4.el6.x86_64
[root@CLanguage src] # rpm-e-- nodeps mysql-5.1.47-4.el6.x86_64
[root@CLanguage src] # rpm-e-- nodeps mysql-libs-5.1.47-4.el6.x86_64
[root@CLanguage src] # rpm-e-- nodeps mysql-devel-5.1.47-4.el6.x86_64
[root@CLanguage src] # rpm-qa | grep mysql
[root@CLanguage src] #
Create database directories and users and groups:
[root@CLanguage src] # mkdir / data
[root@CLanguage src] # mkdir / data/mysqldata # data storage directory
[root@CLanguage src] # groupadd mysql # create a mysql group
[root@CLanguage src] # useradd-r-s / sbin/nologin-g mysql mysql-d / usr/local/src/mysql # add mysql users so that their shell mode is nologin (login prohibited)
[root@CLanguage mysql] # chown-R mysql.
[root@CLanguage mysql] # chgrp-R mysql.
[root@CLanguage mysql] # chown-R mysql / data/mysqldata
Install the numactl component before installation, or you may get an error: bin/mysqld: error while loading shared libraries: libnuma.so.1
[root@CLanguage mysql] # yum-y install numactl
(you can install it using a local CD yum source, as long as it is built. )
Configuration parameters:
[root@CLanguage src] # cd mysql
[root@CLanguage mysql] # bin/mysqld-initialize-user=mysql-basedir=/usr/local/src/mysql-datadir=/data/mysqldata/ # configuration parameters
2018-01-31T08:41:32.144065Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details).
2018-01-31T08:41:34.501273Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-01-31T08:41:34.943351Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-01-31T08:41:35.016168Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 8b673fc1-0662-11e8-a70a-000c298536ba.
2018-01-31T08:41:35.021358Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-01-31T08:41:35.025019Z 1 [Note] A temporary password is generated for root@localhost: dhaMrqAVZ5-C {Last root@localhost: followed by a temporary password}
-- the directory where the basedir=/usr/local/src/mysql # mysql file is located
-- datadir=/data/mysqldata/ # database storage directory
[root@CLanguage mysql] # bin/mysql_ssl_rsa_setup-- datadir=/data/mysqldata/
# configuration parameters
Modify the system configuration file:
The my-default.cnf file was not found in the support-files directory, so it had to be created manually.
[root@CLanguage support-files] # vim / etc/my.cnf (create a my.cnf and copy the following code into it. Remember that the following directories need to be manually modified to your own defined directories)
[client]
Port = 3306
Socket = / tmp/mysql.sock
[mysqld]
Character_set_server=utf8
Init_connect='SET NAMES utf8'
Basedir=/usr/local/src/mysql # file storage directory
Datadir=/data/mysqldata/ # database storage directory
Socket=/tmp/mysql.sock # should be consistent with the above socket values
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
Lower_case_table_names = 1
Sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Max_connections=5000
Default-time_zone ='+ 8VR 00'
(the parameters are not complete here, so you can copy a my.cnf file somewhere else.)
Or copy the following:
[mysqld]
Sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES # General configuration options
Basedir = / usr/local/src/mysql # needs to be modified
Datadir = / data/mysqldata # needs to be modified
Port = 3306
Socket = / var/run/mysqld/mysqld.sock
Character-set-server=utf8
Back_log = 300
Max_connections = 3000
Max_connect_errors = 50
Table_open_cache = 4096
Max_allowed_packet = 32m
# binlog_cache_size = 4m
Max_heap_table_size = 128m
Read_rnd_buffer_size = 16m
Sort_buffer_size = 16m
Join_buffer_size = 16m
Thread_cache_size = 16
Query_cache_size = 128m
Query_cache_limit = 4m
Ft_min_word_len = 8
Thread_stack = 512K
Transaction_isolation = REPEATABLE-READ
Tmp_table_size = 128m
# log-bin=mysql-bin
Long_query_time = 6
Server_id=1
Innodb_buffer_pool_size = 1G
Innodb_thread_concurrency = 16
Innodb_log_buffer_size = 16m
Innodb_log_file_size = 512m
Innodb_log_files_in_group = 3
Innodb_max_dirty_pages_pct = 90
Innodb_lock_wait_timeout = 120
Innodb_file_per_table = on
[mysqldump]
Quick
Max_allowed_packet = 32m
[mysql]
No-auto-rehash
Default-character-set=utf8
Safe-updates
[myisamchk]
Key_buffer = 16m
Sort_buffer_size = 16m
Read_buffer = 8m
Write_buffer = 8m
[mysqlhotcopy]
Interactive-timeout
[mysqld_safe]
Open-files-limit = 8192
[root@CLanguage support-files] # cp mysql.server / etc/init.d/mysqld
[root@CLanguage support-files] # vim / etc/init.d/mysqld
Modify / etc/init.d/mysqld to fill in the file storage path and data storage path after basedir and datadir
Start mysql:
[root@CLanguage mysql] # bin/mysqld_safe-- user=mysql & # Detection
[root@CLanguage run] # / etc/init.d/mysql start (an error will be reported here, because the mysqld folder cannot be found, so create and grant permissions. )
[root@CLanguage mysql] # cd / var/run/
[root@CLanguage run] # mkdir mysqld
[root@CLanguage run] # chown-R mysql mysqld
[root@CLanguage run] # chgrp-R mysql mysqld
[root@CLanguage run] # / etc/init.d/mysqld start
Starting MySQL... [OK]
Login to mysql has changed the password:
If you cannot log in using bin/mysql-uroot-p, you can use the following methods to reset the password:
Modify / etc/my.cnf file
Add "skip-grant-tables" under [mysqld]
(the skip-grant-tables command is to skip authentication and log in directly. Personally, I think it is like the single-user mode of linux to change the password of mysql. )
Restart mysql
Enter bin/mysql on the command line to log in (entering the mysql command directly may prompt that the command cannot be found. Because the path path is not set, the path path description is added later. )
Mysql > show databases
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
| | sys |
+-+
4 rows in set (0.00 sec)
Mysql > USE mysql; # Select a database
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-A
Database changed
Mysql > update user set authentication_string=password ('123abc') where user='root'
Query OK, 0 rows affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 1
Mysql > flush privileges; # refresh permissions
Query OK, 0 rows affected (0.00 sec)
Mysql > quit
Bye
Log in to mysql again
[root@CLanguage run] # mysql-uroot-p123abc
After the modification is complete, log out of "skip-grant-tables" in my.cnf
Modify the environment variable:
Add the bin path of mysql to / etc/profile
[root@CLanguage mysql] # vim / etc/profile
Add:
Export PATH=/usr/local/src/mysql/bin:$PATH
[root@CLanguage mysql] # source / etc/profile
Configure mysql to start automatically
[root@CLanguage mysql] # chmod 755 / etc/init.d/mysqld
[root@CLanguage mysql] # chkconfig-- add mysqld
[root@CLanguage mysql] # chkconfig-- level 345 mysqld on
In the course of use, it was found that the computer was restarted and mysql could not start. Report that the PID file cannot be found, and the path to store the PID file is: / var/run/mysqld. Every time you restart, you can't find the mysqld folder in the / var/run/ directory. You need to recreate the mysqld folder and modify the users and groups of the folder before you can use it normally.
Solution method
The reason is that the / var/run/mysqld directory needs to be created manually after each restart, because the folder created under the / var/run/ directory is in memory, so the memory is emptied after each restart, and / var/run/mysqld is also cleared, resulting in the failure to start mysql.
Create a directory where the mysqld.pid files are stored, and modify the users and groups to which the folder belongs. Modify the my.cnf file, find pid-file=/var/run/mysqld/mysqld.pid and modify the mysqld.pid storage path to another location. The specific operations are as follows:
Restart mysql to run normally.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.