In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Let's learn about the simple tutorial of MYSQL installation. I believe you will benefit a lot after reading it. The text is not much in essence. I hope the simple tutorial of MYSQL installation is what you want.
Root@localhost ~] # mysql-uroot-p
Enter password:
MariaDB [(none)] > show databases
+-+
| | Database |
+-+
| | information_schema |
| | db2 |
| | mysql |
| | performance_schema |
+-+
4 rows in set (0.01sec)
MariaDB [(none)] > use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-A
Database changed
MariaDB [mysql] > show tables
+-+
| | Tables_in_mysql |
+-+
| | columns_priv |
| | db |
MariaDB [mysql] > select user from user
+-+
| | user |
+-+
| | lee |
| | root |
| | root |
| | root |
+-+
4 rows in set (0.00 sec)
MariaDB [mysql] > select * from user
+-- + -+- -+ -+-+-- +- -- +-- +-+
MariaDB [mysql] > desc user
+-+-
| | Field | Type | Null | Key | Default | Extra | |
+-+-
| | Host | char (60) | NO | PRI | |
| | User | char (16) | NO | PRI | |
| | Password | char (41) | NO | |
| | Select_priv | enum ('Nickel Magazine Y') | NO | | N |
Yum install-y mariadb-server
Systemctl start mariadb
Mysql
Netstat-antlpe | grep mysql
Vim / etc/my.cnf
Add under [mysqld] module
Skip-networking=1 # # close the port opened by the database on the network, and lock it to prevent others from attacking. This port is invisible.
Systemctl restart mariadb
Netstat-antlpe | grep mysql
Mysql
Mysql_secure_installation set password anonymous users cannot log in remotely, can not log in, etc.
Mysql-uroot-p
Redhat password
MariaDB [(none)] > create database westos
Query OK, 1 row affected (0.00 sec)
MariaDB [westos] > create table linux (
-> username varchar (15) not null
-> password varchar (15) not null
->)
Query OK, 0 rows affected (0.04 sec)
MariaDB [westos] > show tables
+-+
| | Tables_in_westos |
+-+
| | linux |
+-+
1 row in set (0.00 sec)
MariaDB [westos] > insert into linux values ('user1','123')
Query OK, 1 row affected (0.01sec)
MariaDB [westos] > insert into linux values ('user2',password (' 123'))
Query OK, 1 row affected, 1 warning (0.04 sec) encrypt passwords
MariaDB [westos] > select * from linux
+-+ +
| | username | password |
+-+ +
| | user1 | 123 | |
| | user2 | * 23AE809DDACAF9 |
+-+ +
2 rows in set (0.00 sec)
MariaDB [westos] > update linux set password=password ('234') where username='user1'
Query OK, 1 row affected, 1 warning (0.61 sec)
Rows matched: 1 Changed: 1 Warnings: 1
MariaDB [westos] > delete from linux where username='user1'
Query OK, 1 row affected (0.02 sec)
MariaDB [westos] > alter table linux add age varchar (4)
Query OK, 1 row affected (0.11 sec)
Records: 1 Duplicates: 0 Warnings: 0
MariaDB [westos] > select * from linux
+-+
| | username | password | age | |
+-+
| | user2 | * 23AE809DDACAF9 | NULL | |
+-+
1 row in set (0.00 sec)
MariaDB [westos] > alter table linux drop age
Query OK, 1 row affected (0.40 sec)
Records: 1 Duplicates: 0 Warnings: 0
MariaDB [westos] > select * from linux
+-+ +
| | username | password |
+-+ +
| | user2 | * 23AE809DDACAF9 |
+-+ +
1 row in set (0.00 sec)
MariaDB [westos] > alter table linux add age varchar (5) after username
Query OK, 1 row affected (0.10 sec)
Records: 1 Duplicates: 0 Warnings: 0
MariaDB [westos] > select * from linux
+-+
| | username | age | password | |
+-+
| | user2 | NULL | * 23AE809DDACAF9 |
MariaDB [westos] > alter table linux drop age
MariaDB [westos] > delete from linux where username='user1'
Query OK, 0 rows affected (0.00 sec)
MariaDB [westos] > drop table linux
Query OK, 0 rows affected (0.32 sec)
MariaDB [westos] > drop database westos
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)] > show databases
+-+
| | Database |
+-+
| | information_schema |
| | db2 |
| | mysql |
| | performance_schema |
+-+
4 rows in set (0.00 sec)
Query OK, 1 row affected (0.41 sec)
[root@localhost] # mysqldump-u root-predhat westos
[root@localhost ~] # mysqldump-u root-predhat westos > / mnt/westos.sql
[root@localhost] # mysql-uroot-predhat-e "drop database westos;"
[root@localhost] # mysql-uroot-p
Enter password:
Welcome to the MariaDB monitor. Commands end with; or\ g.
Your MariaDB connection id is 15
Server version: 5.5.35-MariaDB MariaDB Server
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
MariaDB [(none)] > show databases
+-+
| | Database |
+-+
| | information_schema |
| | db2 |
| | mysql |
| | performance_schema |
+-+
4 rows in set (0.01sec)
MariaDB [(none)] > mysql-uroot-predhat-e "create database westos;"
-> Ctrl-C-exit!
Aborted
[root@localhost] # mysql-uroot-predhat-e "create database westos;"
[root@localhost] # mysql-uroot-predhat westos
< /mnt/westos.sql [root@localhost ~]# mysql -uroot -predhat -e "select * from westos.linux;" +----------+----------+ | username | password | +----------+----------+ | user1 | 123 | | user2 | 456 | +----------+----------+ MariaDB [(none)]>Create user lee@localhost identified by 'lee'
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)] > grant insert,update,delete,select on westos.linux to lee@localhost
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)] > grant select on westos.* to lee@'%'
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)] > show grants for lee@'%'
+-+
| | Grants for lee@% |
+-+
| | GRANT USAGE ON *. * TO 'lee'@'%' IDENTIFIED BY PASSWORD' * 28C1E2BE21B45562A34B6CC34A19CFAFC2F88F96' |
| | GRANT SELECT ON `westos`.* TO 'lee'@'%' |
+-+
2 rows in set (0.00 sec)
MariaDB [(none)] > revoke delete on westos.linux from lee@localhost
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)] > drop user lee@'localhost'
Query OK, 0 rows affected (0.00 sec)
[root@localhost] # mysqladmin-uroot-pwestos password redhat
[root@localhost ~] # systemctl stop mariadb.service
[root@localhost ~] # ps aux | grep mysql
Root 5724 0.0 112640 980 pts/1 S + 01:53 0:00 grep-- color=auto mysql
[root@localhost] # mysqld_safe-- skip-grant-tables &
[1] 5744
[root@localhost] # killall-9 mysqld_safe
[1] + Killed mysqld_safe-- skip-grant-tables
[root@localhost ~] # ps aux | grep mysql
[root@localhost] # kill-9 6019
[root@localhost ~] # ps aux | grep mysql
Root 6083 0.0 112640 980 pts/1 R + 02:02 0:00 grep-color=auto mysql
[root@localhost ~] # systemctl start mariadb
@ you can create a database by clicking the mouse punctuation on the web page, insert table, delete table, database, etc.
Lftp 172.25.254.250:/pub/docs/software > get phpMyAdmin-3.4.0-all-languages.tar.bz2
4548030 bytes transferred
Lftp 172.25.254.250:/pub/docs/software > quit
[root@localhost ~] # ls
Anaconda-ks.cfg lala.py Public
Backup.dump linux.dump Templates
Desktop Music Videos
Documents phpMyAdmin-3.4.0-all-languages.tar.bz2 westos.dump
Downloads Pictures
[root@localhost] # tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2-C / var/www/html/
[root@localhost ~] # ls
Anaconda-ks.cfg lala.py Public
Backup.dump linux.dump Templates
Desktop Music Videos
Documents phpMyAdmin-3.4.0-all-languages.tar.bz2 westos.dump
Downloads Pictures
[root@localhost ~] # cd / var/www/html/
[root@localhost html] # ls
PhpMyAdmin-3.4.0-all-languages
[root@localhost html] # mv phpMyAdmin-3.4.0-all-languages/ mysqladmin
Ot@localhost html] # ls
Mysqladmin
[root@localhost html] # cd mysqladmin/
[root@localhost mysqladmin] # ls
Browse_foreigners.php main.php server_status.php
Bs_disp_as_mime_type.php navigation.php server_synchronize.php
Bs_play_media.php phpdoctor.ini server_variables.php
.
[root@localhost mysqladmin] # cp-p config.sample.inc.php config.inc.php
[root@localhost mysqladmin] # vim config.inc.php
17$ cfg ['blowfish_secret'] =' mysql'; / * YOU MUST FILL IN THIS FOR COOKIE AUTH! * /
[root@localhost mysqladmin] # systemctl restart httpd
Test:
Visit http://172.25.254.170/mysqladmin
When you see the phpMyAdmin interface, you will choose Chinese root redhat at this time.
You can create new database tables, insert delete tables, and so on.
# mysql # #
The database is made up of many tables
Yum install-y mariadb-server
Systemctl start mariadb
Mysql
Netstat-antlpe | grep mysql will see port 3306
Vim / etc/my.cnf
Add under [mysqld] module
Skip-networking=1 # # close the port opened by the database on the network and lock it to prevent others from attacking. This is the port look.
Otherwise, others cannot modify the data on the database. 1 table is valid.
Systemctl restart mariadb
Netstat-antlpe | Port 3306 can not be seen by grep mysql at this time
Mysql_secure_installation sets root password anonymous users cannot log in remotely
Mysql-uroot-p
Redhat enter the password of mysql
Basic sql statement operation of @ database @
1 landing
Mysql-uroot-predhat
2 query
Show databases; display database
Use mysql; enters mysql database
Show tables; displays the name of the table in the current library
Select * from user; queries everything in the user table (* can be represented by any field in this table)
Desc user; queries the structure of the user table (displays the names of all fields)
(3) Establishment of database and table
Create database westos creates a westos library
Create table linux (create the linux table and the linux table contains two fields username password
Username varchar (15) not null, username field has a maximum length of 15 characters and cannot be empty
Password varchar (15) not null
);
Insert into linux values ('user1','123'); insert data into the linux table, and the data in the username field is user1
Insert into linux values ('user2',password (' 123')); the data inserted into the password field is encrypted with password
4 update database information
Update linux set password=password ('passwd2') where username='user1'
Update the password for user1
Delete from linux where username='user1'; deletes user1 information
Alter table linux add age varchar (4); add the age field to the last column of the linux table
Alter table linux add age varchar (5) after name; add age field after name field
Alter table linux drop age; deletes the age field
5 Delete the database
Delete from linux where username='user1'; deletes user1 data from the linux table
Drop table linux; deletes linux table
Drop database westos; deletes the westos database
6 backup of database
Mysqldump-u root-predhat-- all-database backs up all data in all tables
Mysqldump-u root-predhat-- all-database-- no-database-- no-data backs up all tables but does not backup data
Mysqldump-u root-predhat westos backup westos database
Mysqldump-u root-predhat westos > / mnt/westos.sql
Back up the westos database and save the data to westos.sql
Mysqldump-u root-predhat westos linux > / mnt/linux.sql
Back up the linux table in mysql
Mysql-uroot-predhat-e "create database westos;" Establishment of westos Library
Mysql-uroot-predhat westos < / mnt/westos.sql Import data into westos Library
7 user authorization must be superuser
Create user lee@localhost identified by 'lee'; sets up a user lee. This user can only log in through this machine.
Create user lee@'%' identified by 'lee'; establishes a user lee, which can log in through the network
Grant insert,update,delect,select on westos.test to lee@localhost
The test table of the user authorization westos database can log in to lee users through the localhost host
Grant select on westos.* to lee@'%'
Show grants for lee@'%' view user authorization
Show grants for lee@localhost
Revoke delete on westos.test from lee@localhost; removes user authorization rights
Drop user lee@'%'; Delete user
8 change the password
Mysqladmin-uroot-predhat password lee
What to do when you forget the superuser password
Mysqld_safe-skip-grant-tables & enable the mysql login interface and ignore the authorization table
Mysql can log in directly without a password.
Update mysql.user set Password=password ('123') where User='root'
Update superuser password information
Ps aux | grep mysql filters all processes in mysql and terminates them
Kill-9 mysqlpid
Systemctl start mariadb restarts mysql
Mysql-uroot-P123 login test
1 installation
Yum install-y httpd php php-mysql
Systemctl start httpd
Systemctl enable httpd
Systemctl stop firewalld
Systemctl disable firewalld
Download phpMyAdmin-3.4.0-all-languages.tar.bz2
Extract tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2-C / var/www/html to the specified directory
Cd / var/www/html
Mv phpMyAdmin-3.4.0-all-languages mysqladmin
Cd mysqladmin
Cp-p config.sample.inc.php config.inc.php
Vim config.inc.php
17$ cfg ['blowfish_secret'] =' mysql'; / * YOU MUST FILL IN THIS FOR COOKIEAUTH! * /
Systemctl restrt httpd
Test:
Visit http://172.25.254.170/mysqladmin
You will see that the phpadmin interface can create a database to add fields and delete tables with one click of the mouse, and it will also be synchronized to the command line. With the command, you can see that it is equivalent to creating, deleting and adding with the command, but phpmyadmin is convenient and fast.
After reading this article on simple tutorials for MYSQL installation, many readers will want to know more about it. For more industry information, you can follow our industry information section.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.