linux mysql installation test

1. Installation
Check whether it has been installed:
yum list installed |grep mysql
rpm -qa|grep mysql
Check whether there is an installed package:
    yum list |grep mysql
Install mysql client:
    yum install mysql
Install mysql server:
    yum install mysql-server
    yum install mysql-devel
 
2. Start && stop
database character set setting
    Add default-character-set=utf8 to the mysql configuration file /etc/my.cnf to
 
start the mysql service:
          service mysqld start or /etc/init.d/mysqld start to
start Start:
          chkconfig --add mysqld
  chkconfig --level 35 mysqld on
Check whether the startup settings are successful chkconfig --list | grep mysql*  
mysqld 0: close 1: close 2: enable 3: enable 4: enable 5: enable 6: close

3. Login

[root@hujinfeng ~]# mysql -uroot -proot

Create root administrator:
          mysqladmin -u root password 123456
Modify root password (original password root, new password 123456)
  mysqladmin -uroot -proot password 123456

Forgot password:
          service mysqld stop

          mysqld_safe - -user=root --skip-grant-tables

          mysql -u root

          use mysql

          update user set password=password("new_pass") where user="root";

          flush privileges;
 
4. Remote access
Open the port number of the firewall
and authorize after login
mysql> GRANT ALL PRIVILEGES ON *.* TO root@"192.168.206.1" IDENTIFIED BY "root";

mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root";

5. Several important directories of Linux MySQL
Database directory
         /var/lib/mysql/
configuration file
         /usr/share /mysql (mysql.server command and configuration file)
related commands
         /usr/bin (mysqladmin mysqldump and other commands)
startup script
         /etc/rc.d/init.d / (The directory where the script file mysql is started)

6. Check the mysql version and status
mysql> select version();
mysql> status

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326900980&siteId=291194637