Installation tutorial for mysql in linux, linuxmysql
Today, we need to use yum to install mysql. In fact, we can also download the mysql installation package on the official website to install it. However, I think it is appropriate to use yum to install it. I just reviewed it again.
The most important thing I learned earlier is that we can install some dependencies through yum, saving a lot of trouble!
1: switch to the root user
[Wls81 @ kafka001 wls81] # sudo su
2: Check whether mysql has been installed before.
Method 1:
[Root @ kafka001 wls81] # service mysqld status
Mysqld: unrecognized service
Method 2: [root @ kafka001 wls81] # rpm-qa | grep mysql
3: If you have installed mysql, you do not have to install it again. Check the available mysql database versions on yum.
[Root @ kafka001 wls81] # yum list | grep mysql
4: If the mysql version information is listed in step 3, you can install mysql.
[Root @ kafka001 wls81] # yum install-y mysql-server mysql-devel
5. view the basic information after installation.
[Root @ kafka001 wls81] $ rpm-qi mysql-server
So far, mysql installation is complete. Next we start mysql. Some Initialization Configuration Information will appear during the first startup, and it will not exist after it is started.
6. Start the mysql service.
[Root @ kafka001 wls81] $ service mysqld start
Every time we use mysql, we need to start mysql, which is very troublesome. Therefore, we need to set the following mysql auto-start
7. Set mysql to start automatically
[Root @ kafka001 wls81] # chkconfig mysqld on
8: Check whether there is a problem with mysql auto-start.
[Root @ kafka001 wls81] # chkconfig -- list | grep mysql
At this time, the installed mysql currently only has a root account, and no password is set, so you need to set the following password for the root user
[Root @ kafka001 wls81] # mysqladmin-u root password 'root'