MySQL compilation, installation, and user management
MySQL user password modification:
1. mysqladmin-u USERNAME-h HOSTNAME password 'new _ pass'-p
2. set password for 'username' @ 'host' = PASSWORD ('new _ pass ');
3. UPDATE mysql. user set password = PASSWORD ('new _ pass') where condition;
Delete A User:
Drop user ""@"";
Install cmake before compiling and installing mysql. download it from the official website.
The download page is cmake-3.6.1.tar.gz.
Tar-xzvf cmake-3.6.1.tar.gz
Cd cmake-3.6.1
./Configure
Make & make install
Compile and install mysql-5.6.31.tar: http://mirrors.sohu.com/mysql/MySQL-5.6/
1. groupadd-r-g 308 mysql
2. useradd-g 308-r-u 308 mysql
3. mkdir-pv/mydata/data (directory for storing data)
4. chown-R mysql. mysql/mydata/data
5. tar-xzvf mysql-5.6.31.tar.gz
6. cd mysql-5.6.31
7. cmake.-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \
-DMYSQL_DATADIR =/mydata/data \
-DSYSCONFDIR =/etc \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_ARCHIVE_STORAGE_ENGINE = 1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1 \
-DWITH_SSL = system \
-DWITH_ZLIB = system \
-DWITH_LIBWRAP = 0 \
-DMYSQL_UNIX_ADDR =/tmp/mysql. sock \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci
(If this problem occurs, cocould NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
Solution:
Yum-y install ncurses-devel
Rm-f CMakeLists.txt
Decompress mysql again.
8. make & make install
9. cd/usr/local/mysql/
10. chown-R: mysql.
11. scripts/mysql_install_db -- user = mysql -- datadir =/mydata/data
12. cp support-files/mysql. server/etc/init. d/mysqld
13. chkconfig mysqld -- add
14. Add export PATH = $ PATH:/usr/local/mysql/bin to vim/etc/profile. d/mysql. sh.
15. source/etc/profie. d/mysql. sh
16. modify the configuration file
Bytes -------------------------------------------------------------------------------------------------------------------
Installation supplement:
Cmake specifies the compilation option in a different way than make, and its implementation method is compared as follows:
./Configure cmake.
./Configure -- help cmake.-LH or ccmake.
This option is often used to specify the installation path of the installation file:
-DCMAKE_INSTALL_PREFIX =/usr/local/mysql
-DMYSQL_DATADIR =/data/mysql
-DSYSCONFDIR =/etc
By default, the compiled storage engines include csv, myisam, myisammrg, and heap. To install other storage engines, you can use the following compilation options:
-DWITH_INNOBASE_STORAGE_ENGINE = 1
-DWITH_ARCHIVE_STORAGE_ENGINE = 1
-DWITH_BLACKHOLE_STORAGE_ENGINE = 1
-DWITH_FEDERATED_STORAGE_ENGINE = 1
To explicitly specify not to compile a storage engine, you can use the following options:
-Dwithout1_storage_engine = 1
For example:
-DWITHOUT_EXAMPLE_STORAGE_ENGINE = 1
-DWITHOUT_FEDERATED_STORAGE_ENGINE = 1
-DWITHOUT_PARTITION_STORAGE_ENGINE = 1
If you want to compile it into other functions, such as SSL, you can use the following options to compile a database or not use a database:
-DWITH_READLINE = 1
-DWITH_SSL = system
-DWITH_ZLIB = system
-DWITH_LIBWRAP = 0
Other common options:
-DMYSQL_TCP_PORT = 3306
-DMYSQL_UNIX_ADDR =/tmp/mysql. sock
-DENABLED_LOCAL_INFILE = 1
-DEXTRA_CHARSETS = all
-DDEFAULT_CHARSET = utf8
-DDEFAULT_COLLATION = utf8_general_ci
-DWITH_DEBUG = 0
-DENABLE_PROFILING = 1
To clear the files generated by the previous compilation, run the following command:
Make clean
Rm CMakeCache.txt
Bytes -------------------------------------------------------------------------------------------------------------------
So far, mysql has been installed
[Root @ bkjia mysql] # connect mysql to the database
Show databases; (view database)
Show engines; (view search engines)
View user information:
Use mysql;
Select User, Host, Password from user;
Delete A User: (for example, an anonymous user has been deleted)
Use mysql;
Drop user "" @ "localhost ";
Change Password:
Use mysql;
Update user set password = password (147852) where user = 'root ';
MyISAM:
Three files per table:
. Frm: Table Structure
. MYD: Table Data
. MYI: Table Index
InnoDB:
All Tables share a tablespace file;
Suggestion: Each table has an independent tablespace file;
. Frm: Table Structure
. Ibd: tablespace (table data and table index)
For unix, if mysql and mysqld are on the same host, they will communicate through mysql. sock.
For windows mysql and msqld on the same host, communication is performed through the shared memory or pipeline.
If not on the same host, it will communicate through the TCP/IP protocol.
MySQL client tool:
Mysql
Mysqldump
Mysqladmin
Mysqlcheck
Mysqlimport
Non-client MySQL Tool
Myisamchk
Myisampack
This article permanently updates the link address: