Get the App
SLTechnology News&Howtos  ›  Database  › 

The basics of daily operation of mysql

Shulou Source: shulou.com Published: 2022-06-01 16:59:43 09月20日 Update

I. Database Version:

Community Enterprise Cluster

Community Edition: Free to use (for personal use, not commercial use)

Enterprise edition: cheaper than cluster edition

Cluster version:

Official website: http://www.mysql.org

II. Installation of mysql (mysql toolkit mysql-server module and function package)

#yum -y install mysql mysql-server ##yum install

Default port: 3306

Main configuration file: /etc/my.cnf

#ps aux |grep mysqld ##View service-related module information

important parameter

--datadir=/var/lib/mysql (data directory)

--socket=/var/lib/mysql/mysql.socket

--basedir=/usr/installation directory

--user= user identity of the process running

--log-error=/var/log/mysqld.log Specifies the database error log directory

#cd /var/lib/mysql

#ls (mysql)

mysql (data table file) ib_lngfilel (index file) mysql.sock

#cd ./ mysql

--datadir data directory

Store database related information

.frm data table structure

.myd data table data

.myi data table index file

mysql.sock database socket file

mysql login

-u Login Name

-p cipher

-h Specifies the mysql server address

-P port

Set password mysqladmin for database administrator

#mysqladmin -uroot password '123'; ##Add initial password

#mysql -uroot -p ##Login to mysql

mysql>create user lisi@'localhost'identified by

'123'; ##Create lisi user local login mysql

mysql>create user zhangsan@'%'identified by '123';##create zhangsan user can log in remotely to mysql from any remote address

mysql>set password for'user'@'login address'=password ("new password");

Forgot database password Solution:

1. stop the database

2. Modify the main configuration file to add a line of code: skip-grant-tables

3. restart the service

4. reset your password

mysql>set password=password ('new password'); ##Change administrator database user password

At this time, an error will be reported because the grant authentication table has been skipped, and the user data table in the database needs to be updated mysql>update mysql.user set password=password ('new password') where user='root';

display database

>show databases;

Display content under a specific database

>use test;

>create table a2(

id int unsigned not null auto_increment,

name char(40) not null default "",

info char(208) null,

primary key(id));

id

name

info

Tags: Data database file user password datasheet directory login address cluster new secret service enterprise information socket module community port administrator index Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MySQL OPPO Reno vpn Apple