Get the App
SLTechnology News&Howtos  ›  Database  › 

How to set the Mysql environment variable

Shulou Source: shulou.com Published: 2022-05-31 19:20:49 09月30日 Update

This article introduces you how to set Mysql environment variables, the content is very detailed, interested friends can refer to, hope to be helpful to you.

1. Mysql installation

# usedel mysql

# groupdel mysql

# groupadd mysql

# useradd-g mysql mysql

# tar-zxvf mysql-5.1.55.tar.gz

# cd mysql-5.1.55

#. / configure\

# >-prefix=/program/mysql\ / / installation path

# >-localstatedir=/var/lib/mysql\ / / File storage path

# >-with-comment=Source\

# >-with-server-suffix=-Community\

# >-with-d-user=mysql\

# >-without-debug\

# >-with-big-tables\

# >-with-charset=utf8\

# >-with-collation=utf8_unicode_ci\

# >-with-extra-charsets=all\

# >-with-pthread\

# >-enable-static\

# >-enable-thread-safe-client\

# >-with-client-ldflags=-all-static\

# >-with-mysqld-ldflags=-all-static\

# >-enable-assembler\

# >-without-innodb\

# >-with-innodb\

# >-without-isam\

# >-without-ndb-debug\

# >-with-unix-socket-path=/var/lib/mysql/mysql.sock

# make & & make install

# cp. / support-files/my-medium.cnf / etc/my.cnf

# / usr/local/mysql/bin/mysql_install_db-user=mysql

# chown mysql:mysql-R / usr/local/mysql

# chgrp-R mysql / usr/local/mysql

# / usr/local/mysql/bin/mysqld_safe-user=mysql &

# chmod + x. / support-files/mysql.server

# cp. / support-files/mysql.server / etc/init.d/mysqld

# chkconfig-add mysqld

# chkconfig-level 2345 mysqld on

# service mysqld restart

# / usr/local/mysql/bin/mysqladmin-uroot password "new_pass" / / modify root user password

# netstat-nplt | grep mysql / / View the information of mysql listening port

# ps-aux | grep mysql / / View the process information that mysql is running

2. Mysql password recovery

# service mysqld stop

# killall-TERM mysqld

# / usr/local/mysql/bin/safe_mysqld-skip-grant-tables &

# / usr/local/mysql/bin/mysq/mysql

> use msyqlmysql

> upadate user set password=password ("new_pass") where user= "root"

> flush privileges

> exit

# service mysqld start#mysql-uroot-p / / if prompted for a password, the password cracking is completed successfully

3. Setting of mysql environment variable:

The first kind:

# export PATH=$PATH:/usr/local/mysql/bin/

# export / / View environment variables

The second kind:

# vi / etc/profileexport PATH= "$PATH: file path" / / modify the environment variable through the configuration file (you need to log out of the system to take effect)

# env / / View environment variables

The third kind:

# vi / root/.bashrcexport PATH= "$PATH: file path" / / modify the environment variables of root users (you need to log out of the system to take effect)

# echo $PATH / / View environment variables

On how to set Mysql environment variables to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Variables environment passwords files paths information content more users systems help good success interests guys buddies articles knowledge ports articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia MariaDB Shulou Technology OPPO Reno Xiaomi