In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the "detailed installation steps of Mysql database" related knowledge, in the actual case operation process, many people will encounter such a dilemma, and 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!
Mysql installation steps
Due to the continuous update to add more features, so it is best to choose to install version 5.5 or above, I choose to install the version of mysql is mysql-5.6.4-m7.tar.gz, so the installation method uses Cmake, which is different from the version below 5.5 that uses configure. The following are the detailed installation steps:
1. Decompress the compressed file:
Tar-zxvf mysql-5.6.4-m7.tar.gz
2. Enter the decompressed folder:
Cd mysql-5.6.4-m7
3. Recognize the CMAKE configuration options of Mysql:
Www.2cto.com
1 > basic configuration commands
Configure command
CMake command
Action
. / configure
Cmake.
Configure by default option
. / configure-- help
Cmake. -LH or ccmake.
View command help
Make clean
Rm config.cache
Make clean
Rm CMakeCache.txt
Clear old object files and cached information before reconfiguration and compilation
2 > Mysql installation layout options
Configure option
CMake option
Action www.2cto.com
-- prefix=/usr
-DCMAKE_INSTALL_PREFIX=/usr
Home directory of the installation
-- libexecdir=/usr/sbin
-DINSTALL_SBINDIR=sbin
Mysqld directory
-- localstatedir=/var/lib/mysql
-DMYSQL_DATADIR=/var/lib/mysql
Data directory
-- sysconfdir=/etc/mysql
-DSYSCONFDIR=/etc/mysql
Config directory (my.cnf)
-- with-plugindir=/usr/lib64/mysql/plugin
-DINSTALL_PLUGINDIR=lib64/mysql/plugin
Plug-in directory
-- mandir=/usr/share/man
-DINSTALL_MANDIR=share/man
Help documentation directory
-- sharedstatedir=/usr/share/mysql
-DINSTALL_SHAREDIR=share
Shared data directory
-- libdir=/usr/lib64/mysql
-DINSTALL_LIBDIR=lib64/mysql
Library file installation directory www.2cto.com
-- includedir=/usr/include/mysql
-DINSTALL_INCLUDEDIR=include/mysql
Header file installation directory
-- infodir=/usr/share/info
-DINSTALL_INFODIR=share/info
Info file directory www.2cto.com
3 > Mysql Storage engine options
Because of the plug-in form of Mysql's storage engine room, you need to use command options to select the type of engine to use, such as: InnoDB, ARCHIVE, and BLACKHOLE engines:
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
4 > other options
Configure option
CMake option
Action
-- with-tcp-port-=3306
-DMYSQL_TCP_PORT=3306
TCP/IP port number
-- with-unix-socket-path=/tmp/mysqld.sock
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock
UNIX socket file
-- enable-local-infile
-DENABLED_LOCAL_INFILE=1
Enable Local variables that support importing data
-- with-extra-charsets=all
-DEXTRA_CHARSETS=all
Additional character set
-- with-charset=utf8
-DDEFAULT_CHARSET=utf8
Default character set www.2cto.com
-- with-collation=utf8_general_ci
-DDEFAULT_COLLATION=utf8_general_ci
Default sort character set
-- with-mysqld-user=mysql
-DMYSQL_USER=mysql
Those who start mysql
-- without-debug
-DWITH_DEBUG=0
Whether debugging is supported
4. Add new users
Sudo adduser mysql
5. Configure Mysql installation options as needed
With the above information, you can choose the appropriate command options to install according to your own needs.
Cmake.
-DCMAKE_INSTALL_PREFIX=/mysql\
-DMYSQL_DATADIR=/mysql/Data\
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock\
-DMYSQL_USER=mysql\
-DWITH_MYISAM_STORAGE_ENGINE=1\
-DWITH_INNOBASE_STORAGE_ENGINE=1\
-DWITH_MEMORY_STORAGE_ENGINE=1\
-DENABLED_LOCAL_INFILE=1
(note: if you run cmake error Curses library not found, install the libncurses5-dev package yourself, then run rmCMakeCache.txt to clean the cache and rerun the Cmake command)
Make www.2cto.com
Sudo make install
6. Install the default database
Cd / mysql/scripts
Sudo. / mysql_install_db-basedir=/usr/local/mysql--datadir=/usr/local/mysql/data-user=mysql
(if there is an error prompt FATALERROR: Could not find. / bin/my_print_defaults, please note that the option is "- -" instead of "-")
7. Copy the mysql configuration file to the system configuration path
Cd / usr/local/mysql/support-files
Sudo cp my-medium.cnf / etc/my.cnf
8. Copy service files (can be used when using the service command)
Sudo cp mysql.server / etc/init.d/mysqld
9. Switch the user to mysql and start mysql
Su mysql www.2cto.com
Service mysqld start
Exit
(su mysql-c "service mysqld start" is recommended)
10. Check the startup status
Netstat-nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
Tcp 0 0 0.0.0.0 3306 0.0.0.015 * LISTEN
Since the default port for mysql under an unspecified port is 3306, it can be seen that mysql has been installed successfully.
11. Set up the soft connection, add mysql (basic command), mysqldump (backup command), mysqladmin (management command) to / usr/bins so that it can run www.2cto.com directly in shell
Sudo ln-s / usr/local/mysql/bin/mysql / usr/bin
Sudo ln-s / usr/local/mysql/bin/mysqldump / usr/bin
Sudo ln-s / usr/local/mysql/bin/mysqladmin / usr/bin
So far, all the installation work has been completed!
This is the end of the "detailed installation steps for Mysql Database". 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.