91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

mysql 數據庫的安裝之 二 二進制安裝

發布時間:2020-05-18 13:20:36 來源:網絡 閱讀:1052 作者:ahtornado 欄目:數據庫

#二進制安裝mysql,直接解壓初始化數據庫就可以了

1.創建用戶和組

[root@Lnmp tools]#useradd mysql -s /sbin/nologin/ -M

2.解壓安裝包

[root@Lnmp tools]#tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz 


[root@Lnmp tools]#mv mysql-5.5.32-linux2.6-x86_64 mysql

[root@Lnmp tools]#mv mysql /application/ 

#獨立安裝數據庫到此結束。

[root@Lnmp tools]# mkdir -p /application/mysql/data/


[root@Lnmp tools]#chown -R mysql.mysql /application/mysql/data


3.初始化數據庫

[root@Lnmp tools]# cd /application/mysql/

[root@Lnmp mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/application/mysql/ --datadir=/application/mysql/data/

WARNING: The host 'Lnmp' could not be looked up with resolveip.

This probably means that your libc libraries are not 100 % compatible

with this binary MySQL version. The MySQL daemon, mysqld, should work

normally with the exception that host name resolving will not work.

This means that you should use IP addresses instead of hostnames

when specifying MySQL privileges !

Installing MySQL system tables...

OK

Filling help tables...

OK


[root@Lnmp mysql]# \cp support-files/mysql.server /etc/init.d/mysqld


[root@Lnmp mysql]#cp support-files/my-small.cnf /etc/my.cnf  #指定配置文件


#如果不指定則,啟動時出現:

ERROR 2002 (HY000):Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock/(2)


4.啟動Mysql:

[root@Lnmp mysql]# /etc/init.d/mysqld start 

/etc/init.d/mysqld: line 276: cd: /usr/local/mysql: No such file or directory

Starting MySQL ERROR! Couldn't find MySQL server (/usr/local/mysql/bin/mysqld_safe)

如果不成功則修改下面:

[root@Lnmp mysql]# vi /etc/init.d/mysqld  +46

basedir=/application/mysql

datadir=/application/mysql/data


[root@Lnmp mysql]# /etc/init.d/mysqld start

Starting MySQL.. SUCCESS! 


#登錄

#mysql

出現下面錯誤:

#-bash:mysql:command not found

mysql 對應的路徑不在path目錄下面

使用全路徑進入mysql:

/application/mysql/bin/mysql

或者在文件最后加上:

vi /etc/profile

PATH="/application/mysql/bin/:$PATH"

#. /etc/profile   #使之生效

mysql>


#設置密碼,不要在mysql>  下面設置密碼,在#后面設置密碼

/application/mysql/bin/mysqladmin -u  root password 'passwd123'

#重新登錄


mysql -u root -p

passwd123


5.數據優化:

select version();         #查看數據庫版本

select user();            #查看當前的用戶

mysql> show databases;    #查看數據庫

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+


mysql>drop database test; #安全設置,刪除沒有用的數據庫

#最終優化為:

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

+--------------------+

mysql> select user,host from mysql.user;  #查詢表中的用戶

+------+-----------+

| user | host      |

+------+-----------+

| root | 127.0.0.1 |

| root | ::1       |

|      | Lnmp      |

| root | Lnmp      |

|      | localhost |

| root | localhost |

+------+-----------+

mysql>delete from mysql.user where(host="Lnmp");

mysql>delete from mysql.user where(host="::1");

mysql> drop user ""@localhost;

#最終優化為:

mysql> select user,host from mysql.user;

+------+-----------+

| user | host      |

+------+-----------+

| root | 127.0.0.1 |

| root | localhost |

+------+-----------+

最后:

flush privileges;


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

渭源县| 花莲市| 潮安县| 通河县| 泰州市| 沁源县| 城步| 分宜县| 东明县| 固阳县| 且末县| 苍山县| 山西省| 水富县| 鸡泽县| 陆丰市| 旬阳县| 淮安市| 台前县| 那曲县| 五峰| 深泽县| 瓦房店市| 玛多县| 丰镇市| 万全县| 阿尔山市| 枣庄市| 民权县| 嵊州市| 闻喜县| 运城市| 毕节市| 罗定市| 买车| 中卫市| 福州市| 抚宁县| 凭祥市| 公主岭市| 陵水|