Get the App
SLTechnology News&Howtos  ›  Database  › 

Mysql start and stop and basic use, garbled handling

Shulou Source: shulou.com Published: 2022-06-01 17:44:32 10月24日 Update

1) You can use the decompression version to decompress directly: for example, mysql-5.7.9-linux-glibc 2.5-x86_64.tar.gz

2)Put the prepared my.cnf (this file can be copied from my_default.cnf in the support-files directory under mysql directory, and then add some parameters to it) into the mysql decompression directory

My.cnf is specifically:

#For advice on how to change settings please see

#http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

# DO NOT EDIT THIS FILE. It's a template which will be copied to the

# default location during install, and will be replaced if you

#*** upgrade to a newer version of MySQL.

[mysqld]

character-set-server=utf8

collation-server=utf8_general_ci

Remove leading # and set to the amount of RAM for the most important data

#cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.

innodb_buffer_pool_size = 128M

skip-host-cache

skip-name-resolve

lower_case_table_names=1

#Remove leading # to turn on a very important data integrity option: logging

changes to the binary log between backups.

#log_bin

#These are commonly set, remove the # and set as required.

basedir =/home/bes/webgate/mysql-5.7.9-linux-glibc2.5-x86_64

datadir =/home/bes/webgate/mysql-5.7.9-linux-glibc2.5-x86_64/data

socket=/home/bes/webgate/mysql-5.7.9-linux-glibc2.5-x86_64/mysql.sock

port =3306

#server_id =

Remove leading # to set options mainly useful for reporting servers.

The server defaults are faster for transactions and fast SELECTs.

Adjust sizes as needed, experiment to find the optimal values.

joinbuffersize = 128M

sortbuffersize = 2M

readrndbuffersize = 2M**

max_connections=1000

max_allowed_packet=1073741824

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

innodb_locks_unsafe_for_binlog=1innodb_print_all_deadlocks=1

log-error=/home/bes/webgate/mysql-5.7.9-linux-glibc2.5-x86_64/error.err

You can modify the installation directory

3) Initialize the data and generate a root@localhost account with an empty passwordbr/>innodb_print_all_deadlocks=1

log-error=/home/bes/webgate/mysql-5.7.9-linux-glibc2.5-x86_64/error.err

You can modify the installation directory

3) Initialize the data, it will generate a root@localhost account, the password is empty

The data directory appears below the directory; the service is not started

4)bin/mysqld --defaults-file=${MYSQl_NAME}/my.cnf Start Service

5)Then use the command to change the username password

bin/mysqladmin -uroot password'123456' --socket=mysql.sock

6)will log in with the command

bin/mysql --socket=./ mysql.sock -uroot -p'123456'

Normal access is possible

7) Database backup

bin/mysqldump -uroot -p123456 -h292.168.0.70 Webgate >./ backup.sql

Reduction:

bin/mysqldump -uroot -p123456 -h292.168.0.70 Webgate

Tags: Directory password data file code command account service generation parameter can be passed backup character database method Chinese format version environment user Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB vpn Shulou Information NVidia Huawei