In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the "mysql source code installation method and automatic startup method" related knowledge, in the actual case of the operation process, many people will encounter such a dilemma, then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!
First download the source code version of Mysql at http://dev.mysql.com/downloads/mysql/.
Shell > groupadd mysqlshell > useradd-g mysql mysqlshell > tar-zxvf mysql-VERSION.tar.gzshell > cd mysql-VERSIONshell >. / configure-- prefix=/usr/local/mysqlshell > makeshell > make installshell > cp support-files/my-medium.cnf / etc/my.cnfshell > cd / usr/local/mysqlshell > bin/mysql_install_db-- user=mysqlshell > chown-R root .shell > chown-R mysql varshell > chgrp-R mysql .shell > bin/mysqld_safe-- user=mysql &
If you start with a source RPM, execute the following command:
Shell > rpmbuild-- rebuild-- clean MySQL-VERSION.src.rpm
So you can make a binary RPM that can be installed. For older versions of RPM, you may need to replace the command rpmbuild with rpm.
Note: this procedure does not set a password for any MySQL account.
[@ more@]
The following is a more detailed description of installing the MySQL source distribution:
1. Add a login user and group to mysqld:
2. Shell > groupadd mysql3. Shell > useradd-g mysql mysql
These commands will increase the MySQL group and MySQL users. The syntax of useradd and groupadd may be slightly different in different versions of Unix. It can also be called adduser and addgroup.
You might name these users and groups something other than mysql. If so, replace it with the appropriate name in the following steps.
4. Pick a directory where you want to unlock the distribution and enter it.
5. Get a distribution file from one of the sites listed in Section 2.1.3, "how to get MySQL."
6. Unpack the distribution in the current directory:
7. Shell > gunzip
< /path/to/mysql-VERSION.tar.gz | tar xvf - 该命令创建mysql-VERSION目录。 使用GNU tar,则不再需要gunzip。你可以用下面的命令来解包和提取分发: shell>Tar zxvf / path/to/mysql-VERSION-OS.tar.gz
8. Go to the top-level directory of the unpacked distribution:
9. Shell > cd mysql-VERSION
Note that MySQL must now be configured and built from the top-level directory. You cannot build in other directories.
10. Configure the release and compile:
11. Shell >. / configure-- prefix=/usr/local/mysql12. Shell > make
When you run configure, you may want to specify some options, run. / configure-- help to get a list of options. Section 2.8.2, "typical configuration options" discusses some useful options.
If configure fails, you will send an email to the MySQL email directory containing all the lines in "config.log" that you think will help you solve the problem, as well as the last few lines of configure output. Use mysqlbug script to mail the error report. See section 1.7.1.3, "how to notify defects and problems."
If the compilation fails, see Section 2.8.4, "dealing with MySQL compilation problems" for help.
13. Install the distribution:
14. Shell > make install
If you want to set an options file, use one of the support-files directories as a template. For example:
Shell > cp support-files/my-medium.cnf / etc/my.cnf
You may need to run these commands with the root user.
If you want to configure to support InnoDB tables, you should edit the / etc/my.cnf file and remove innodb_... Start the # character in front of the option line and change the option value to what you want. See section 4.3.2, "using options file" and section 15.2.3, "InnoDB configuration".
15. Enter the installation directory:
16. Shell > cd / usr/local/mysql
17. If you do not already have an installed MySQL, you must create an MySQL authorization table:
18. Shell > bin/mysql_install_db-- user=mysql
If you run the command with root, you should use the-- user option. The value of the option should be the same as the login account you created to run the server in the first step. If you use this user login to run the command, you can omit the-- user option.
After creating the MySQL authorization table with mysql_install_db, you need to restart the server manually
19. Change the ownership of the program binary to root and the ownership of the data directory to the user from whom you are running mysqld. If you are in the installation directory (/ usr/local/mysql), the command should be:
20. Shell > chown-R root. Shell > chown-R mysql var22. Shell > chgrp-R mysql.
The first command changes all attributes of the file to root users. The second command changes all attributes of the data directory to mysql users. The third command changes the group property to the mysql group.
23. If you like to start MySQL automatically when booting the machine, you can copy the support-files/mysql.server file to where your system has startup files. More information can be found in the support-files/mysql.server script and in Section 2.9.2.2, "automatically starting and stopping MySQL."
24. If the DBI and DBD::mysqlPerl modules are installed, you can use the bin/mysql_setpermission script to add a new account. For instructions, see Section 2.13, "considerations for Perl installation".
After everything is installed, you should use this command to initialize and test your distribution:
Shell > / usr/local/mysql/bin/mysqld_safe-- user=mysql &
If this command prompts mysqld daemon ended and fails immediately, you can find some information in the file "hostname'.err" in the data directory.
For more information about mysqld_safe, see Section 5.1.3, "mysqld_safe:MySQL Server Startup script".
Note: the account in the MySQL authorization form starts without a password. After starting the server, you should use the instructions in Section 2.9, "setup and testing after installation" to set the password.
After installation, you can connect mysql to manage via / usr/local/mysql/bin/mysql. If you have installed apache and can parse php, you can also use phpMyadmin to manage.
Manage your mysql, remember to use mysql or mysqladmin to change the root password after installation, we will not talk about it here, please refer to the relevant article.
Control mysql through / usr/local/mysql/libexec/mysqld to control whether to start or stop mysql:
# / usr/local/mysql/libexec/mysqld start # start mysql
# / usr/local/mysql/libexec/mysqld stop # stop mysql
# / usr/local/mysql/libexec/mysqld restart # restart mysql
For FreeBSD users, in order to run mysql every time the system is rebooted, you can write a script and put it in the / usr/local/etc/rc.d directory to run mysql. Let's write a script mysql_start.sh
#! / bin/sh
/ usr/local/mysql/bin/mysqld_safe&
Then save it to the / usr/local/etc/rc.d directory so that you can start mysql after the reboot system.
This is the end of the content of "mysql source code installation method and automatic startup method". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.