Linux MySQL installation configuration MySQL configuration parameters

  • 2020-05-10 23:03:17
  • OfStack

1. Download, compile and install
#cd /usr/local/src/
#wget http://mysql.byungsoo.net/Downloads/MySQL-5.1/mysql-5.1.38.tar.gz
# tar � xzvf mysql - 5.1.38. tar. gz.. / software /
#./configure
--prefix=/usr/local/mysql //MySQL installation directory
--datadir=/mydata // database directory
-- with-charset =utf8 // use UTF8
-- with-extra-charsets =complex // install all the extended character sets
-- enable-thread-safe-client // enable client safe threads
-- with-big-tables // enable large tables
-- with-ssl // use SSL for encryption
-- with-embedded-server // compiled to embedded MySQL library (libmysqld.a),
-- enable-local-infile // allows data to be imported locally
-- enable-assembler // assembles the common operator x86 for improved performance
-- with-plugins =innobase // database plug-in
-- with-plugins =partition // subtable function to divide a large table into several small tables
#make && make install // compile and install
2. Create new users and groups
#groupadd mysql // build MySQL group
useradd-g mysql-s /sbin/nologin mysql // MySQL users belong to the MySQL group
Configuration of 3.
chown-R mysql:mysql /usr/local/mysql/ give MySQL users and groups access to the MySQL directory
# cp/usr local/src/software/mysql - 5.1.38 / support - files/my - medium. cnf/etc/my cnf / / embossed into the config file my cnf
# / usr local/mysql bin/mysql_install_db MySQL user = mysql / / used to initialize the database
# chown - R mysql: mysql/usr/local/mysql/var / / / give MySQL owner the initialization of the database directory
# / usr local/mysql bin/mysqld_safe - user = mysql & start MySQL / /
4. Other
#cp /usr/local/src/software/ mysql-5.1.38/support-files/mysql.server /etc/init.d/mysqld
#chmod 755 /etc/init.d/mysqld
#chkconfig --add mysqld
#chkconfig mysqld on
#service mysqld restart
5. Login test
#cd /usr/local/mysql/bin
#mysql
> show databases;
#
The MySQL installation is complete

mysql configuration method under linux
The configuration file path for mysql in linux is under /usr/share/mysql
my-huge.cnf, my-large.cnf, my-medium, my-small.cnf
Open one of these files as needed:
Find [mysqld] in the file
Add datadir = FILEPATH /* this path is the path to the database */
And I'm gonna save it
Enter in shell
#cp my-***.cnf /etc
#cd /etc
mv my. cnf my. cnf. bak /* back up the system's previous mysql configuration file */
#mv my-***.cnf my.cnf
service mysqld start /* start mysql service */
Configure mysql to start from scratch. Select mysqld with a space in the popup window and save */

Related articles: