In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "the installation process of mysql under CentOS". In the daily operation, I believe that many people have doubts about the installation process of mysql under CentOS. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "the installation process of mysql under CentOS". Next, please follow the editor to study!
1] CentOS mysql installation and decompression
[root@localhost root] # cd / usr/local/mysql/software
[root@localhost software] # ls
Mysql-4.0.16.tar.gz
[root@localhost software] # tar zxvf mysql-4.0.16.tar.gz
2] CentOS mysql installation and CentOS mysql compilation: it is worth noting that we need to install mysql-4.0.16 into our designated directory. For the sake of system and security and optimization, it is recommended to put all the server class software installed with the source package in the / usr/local/mysql directory. So here, we're going to install mysql-4.0.16 into the / usr/local/mysql/mysql directory.
[root@localhost software] # cd
[root@localhost software] # cd mysql-4.0.16
[root@localhost mysql-4.0.16] #
. / configure-prefix=/usr/local/mysql/mysql-with-mysqld-user=beinan-with-extra-charsets=all-with-unix-socket-path=/usr/local/mysql/mysql/var/mysql.sock
[note] A note on the options for configure:
-- prefix=/usr/local/mysql/mysql installs the mysql-4.0.16 specified in the / usr/local/mysql/mysql directory
-- with-extra-charsets=all 's support for multiple languages
-- with-unix-socket-path=/usr/local/mysql/mysql/var/mysql.sock this specifies the location and file name of the online socket file after the mysql server starts, that is, if the mysql server starts successfully, you can see the mysql.sock file in the / usr/local/mysql/mysql/var directory. If you can't see it, it must be that the CentOS mysql installation won't start.
-- with-mysqld-user=beinan this enables the mysql server to enable the ordinary user beinan in the system to start the CentOS mysql server. Of course, if you want to learn and use it, you can also replace beinan with ordinary users who already exist in your system. For example, if sir already exists in your system, just replace beinan with sir. The advantage of starting the CentOS mysql installation with an ordinary user is that the mysql process will die and exit automatically. Of course, root users can, but sometimes some CentOS mysql installation processes die, but will not automatically exit, root itself can not kill. Therefore, using ordinary users has such an advantage. Most of the CentOS mysql processes will not be dead, but will not exit.
[root@localhost mysql-4.0.16] # make
[root@localhost mysql-4.0.16] # make install
This is the end of the installation.
3] CentOS mysql configuration: installation is only a * * step, and we also need to install the corresponding configuration for CentOS mysql.
In general, CentOS mysql installation needs to find the configuration file my.cnf, which is located in the / etc directory, so we have to put the file my.cnf file in the / etc/ directory. So that the CentOS mysql server can be found when it starts.
After we install CentOS mysql, the configuration files should be in the / usr/local/mysql/mysql/share/mysql directory. There are several configuration files, such as my-huge.cnf my-medium.cnf my-large.cnf my-small.cnf.
Of course, different configuration files are required for different traffic sites and different configuration server environments. Under normal circumstances, the my-medium.cnf configuration file can meet most of our needs.
Go to the / usr/local/mysql directory and see if it has been installed.
[root@localhost mysql-4.0.16] # cd / usr/local/mysql/mysql/
[root@localhost mysql] # ls
Bin include info lib libexec man mysql-test share sql-bench
Let's copy the my-medium.cnf in the / usr/local/mysql/mysql/share/mysql directory as my.cnf to the / etc directory.
[root@localhost mysql] # cp / usr/local/mysql/mysql/share/mysql/my-medium.cnf / etc/my.cnf
After doing this work, you still have to create the MySQL authorization table, otherwise the database will not start. Mysql_install_db, that's what this command is for. The CentOS mysql commands are installed in the / usr/local/mysql/mysql/bin directory.
[root@localhost mysql] # / usr/local/mysql/mysql/bin/mysql_install_db
After running the mysql_install_db command, we look at / usr/local/mysql/mysql and find that there is a directory for var. This directory is used to hold all the databases. For example, after we created the database for linuxsir, there is a directory for linuxsir in the / usr/local/mysql/mysql/var directory. I think you understand this time.
4) it's probably the easiest to start the CentOS mysql server, but don't be happy too soon, because sometimes there are permission errors.
CentOS mysql server startup, should be mysql.server in / usr/local/mysql/mysql/share/mysql directory
The startup method is:
[root@localhost mysql] # / usr/local/mysql/mysql/share/mysql/mysql.server start
If you can't start, please run / usr/local/mysql/bin/mysqld_safe-- user=root can start!
Then enter / usr/local/mysql/mysql/share/mysql/mysql.server start to start successfully
All right, let's set the password to 123456 / usr/local/mysql/bin/mysqladmin-u root password 123456
If no error is returned, it is correct.
Then type / usr/local/mysql/bin/mysql-u root-p to manage the CentOS mysql installation.
At this point, the study on "the installation process of mysql under CentOS" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.