In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
It is believed that many inexperienced people do not know what to do when CentOS Mysql users set up the compiler parameters of the compiler. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
The establishment of CentOS Mysql user groups is something that CentOS users must learn to use. As there are still many entOS Mysql users who do not know how to use it, let me briefly explain whether it works or not depends on character. CentOS is a community of open source software contributors and users. It recompiles the RHEL source code, becomes one of the many communities that release new releases, and installs CentOS Mysql as it evolves.
1. Establish a CentOS Mysql user group
[root@localhost ~] # grep mysql / etc/group
# query whether the user group mysql exists in the system. If not, add it.
[root@localhost ~] # groupadd mysql
# add a user group named CentOS Mysql
2. Establish CentOS Mysql users
[root@localhost ~] # grep mysql / etc/passwd
# query whether there are CentOS Mysql users in the system. If not, add them.
[root@localhost] # useradd mysql-g mysql-M-s / sbin/nologin
# add a user named CentOS Mysql.
-g: specify the CentOS Mysql user group (group) to which the new user belongs
-M: do not create a root directory
-s: defines that the shell,/sbin/nologin it uses means that the user cannot log in to the system.
3. Decompress: mysql
[root@localhost ~] # cd / usr/local/src/
[root@localhost src] # tar-zxvf mysql-5.0.27.tar.gz
#. (brief information).
# decompress
4. CentOS Mysql users set compiler parameters
[root@localhost src] # cd / usr/local/src/mysql-5.0.27
[root@localhost mysql-5.0.27] # / configure-- prefix=/usr/local/mysql-- with-unix-socket-path=/tmp/mysql.sock-- localstatedir=/usr/local/mysql/data-- with-charset=gbk-- without-debug-- enable-assembler-- without-isam-- with-client-ldflags=-all-static-- with-mysqld-ldflags=-all-static
# these settings tell the compiler how to compile apache:
-prefix=/usr/local/mysql
Specify the CentOS Mysql user installation directory
-with-unix-socket-path=/tmp/mysql.sock
This specifies the location and file name of the online socket file after the CentOS Mysql user server starts.
-localstatedir=/usr/local/mysql/data
Specify the database directory for the CentOS Mysql user
-with-charset=gbk
Add gbk Chinese character support
-without-debug
Remove debug mode
-enable-assembler
Use the assembly version of some character functions
-without-isam
Without isam table type support, it is rarely used now. Isam table is a platform-dependent table.
-with-client-ldflags=-all-static
-with-mysqld-ldflags=-all-static
5. CentOS Mysql user compilation and installation
[root@localhost mysql-5.0.27] # make
# the "make" command compiles source files into executable binaries
[root@localhost mysql-5.0.27] # make install
# "make install" installs binaries and configuration files in the appropriate directory
6. CentOS Mysql user initializes the system library
[root@localhost mysql-5.0.27] #. / scripts/mysql_install_db
7. Other settings for CentOS Mysql users
[root@localhost mysql-5.0.27] # cp support-files/my-medium.cnf / etc/my.cnf-fv
# Note:
-f, delete the file or directory with the same name in the target without prompting.
# there are some other my.cnf configuration files. It is suitable for different application scales. The type is like my-*.cnf. Cp according to your own needs.
[root@localhost mysql-5.0.27] # cp support-files/mysql.server / etc/init.d/mysqld
# add to startup script
[root@localhost mysql-5.0.27] # chmod 700 / etc/init.d/mysqld
[root@localhost mysql-5.0.27] # cd / usr/local
[root@localhost local] # chmod 750mysql-R
# Note:
-R recursively changes the permissions of the directory and its contents.
[root@localhost local] # chown-R mysql.mysql / usr/local/mysql
# set the owner, and mysql will run as a mysql user when it starts, which can improve the security of the system.
[root@localhost local] # chown-R mysql.mysql / usr/local/mysql/data
[root@localhost local] # cd / usr/local/mysql/libexec
[root@localhost libexec] # cp mysqld mysqld.old
[root@localhost libexec] # strip mysqld
[root@localhost libexec] # chkconfig-add mysqld
# add a service, or you can add a service manually.
[root@localhost libexec] # chkconfig-level 345 mysqld on
# set to start on boot
[root@localhost libexec] # service mysqld start
# start the mysql service
[root@localhost libexec] # ln-s / usr/local/mysql/bin/mysql / sbin/mysql
[root@localhost libexec] # ln-s / usr/local/mysql/bin/mysqladmin / sbin/mysqladmin
[root@localhost libexec] # ln-s / usr/local/mysql/bin/mysqldump / sbin/mysqldump
[root@localhost libexec] # mysqladmin-uroot password "youpassword"
# set the password for the root account
[root@localhost libexec] # mysql-uroot-p
# enter the password you set
Mysql > use mysql
Mysql > delete from user where password= ""
# Delete an empty password account for local anonymous connections
Mysql > flush privileges
Mysql > show databases
+-- +
| | Database |
+-- +
| | mysql |
| | test |
+-- +
2 rows in set (0.08 sec)
# display the database and test whether mysql is installed properly by CentOS Mysql users.
Mysql > quit
If you forget your password, you can:
My system is linux, and the newly installed mysql always has an error when entering the mysql tool:
# mysql-uroot-p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Use the method described online to change the password of a root user:
# mysqladmin-uroot-p password' newpassword'
Enter password:
Mysqladmin: connect to server at 'localhost' failed
Error: 'Access denied for user' root'@'localhost' (using password: YES)'
Now I have finally found the solution, as follows (please test method 3 first, thank you! ):
Method 1:
# / etc/init.d/mysql stop
# mysqld_safe-user=mysql-skip-grant-tables-skip-networking &
# mysql-u root mysql
Mysql > UPDATE user SET Password=PASSWORD ('newpassword') where USER='root'
Mysql > FLUSH PRIVILEGES
Mysql > quit
# / etc/init.d/mysql restart
# mysql-uroot-p
Enter password:
After reading the above, have you mastered how CentOS Mysql users set up the compiler parameters? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.