日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

ubuntu 手动安装mysql

發布時間:2023/11/29 数据库 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ubuntu 手动安装mysql 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

申請了一臺云主機,需要手動安裝所有環境,今天將mysql安裝過程記下。

安裝mysql
a. 下載不了gcc, 需要先運行apt-get update
b. cmake報錯,每次要先刪除cmakeCache.txt,再重新跑cmake
c. apt-get install ncurses找不到對應包,google后發現在Ubuntu中'ncurses-devel'是以'libncurses5-dev'命名的。
大致步驟如下
# Preconfiguration setup
shell> groupadd mysql
shell> useradd -r -g mysql mysql
# Beginning of source-build specific instructions
shell> tar zxvf mysql-VERSION.tar.gz
shell> cd mysql-VERSION
shell> cmake .
shell> make
shell> make install
# End of source-build specific instructions
# Postinstallation setup
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql & [以safe模式啟動mysql]
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server


root@AY140420095828962476Z:/usr/local/mysql# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password' ?設置密碼
./bin/mysqladmin -u root -h AY140420095828962476Z password 'new-password'

Alternatively you can run:
./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe & ?啟動mysql

You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl ?全面檢測mysql

Please report any problems with the ./bin/mysqlbug script!

?============================================

裝完成后,發現mysql只能在本機連接,解決方法

1、改表法。可能是你的帳號不允許從遠程登陸,只能在localhost。這個時候只要在localhost的那臺電腦,登入mysql后,更改 "mysql" 數據庫里的 "user" 表里的 "host" 項,從"localhost"改稱"%"

Sql代碼
  • mysql?-u?root?-pvmwaremysql>use?mysql; ??
  • mysql>update?user?set?host?=?'%'?where?user?=?'root'; ??
  • mysql>select?host,?user?from?user;??

  • 3、如果你想允許用戶myuser從ip為192.168.1.6的主機連接到mysql服務器,并使用mypassword作為密碼
    ?

    Sql代碼
  • GRANT?ALL?PRIVILEGES?ON?*.*?TO?'myuser'@'192.168.1.3'?IDENTIFIED?BY? ??
  • 'mypassword'?WITH?GRANT?OPTION;? ??
  • FLUSH???PRIVILEGES;??
  • Sql代碼

  • GRANT?ALL?PRIVILEGES?ON?dk.*?TO?'myuser'@'192.168.1.3'?IDENTIFIED?BY? ??
  • 'mypassword'?WITH?GRANT?OPTION;? ??
  • FLUSH???PRIVILEGES;??

  • 注意授權后必須FLUSH?? PRIVILEGES;否則無法立即生效。?

    另外一種方法:
    在安裝mysql的機器上運行:??
    ? 1、d:\mysql\bin\>mysql?? -h?? localhost?? -u?? root??
    ??????? //這樣應該可以進入MySQL服務器??
    ? 2、mysql>GRANT?? ALL?? PRIVILEGES?? ON?? *.*?? TO?? 'root'@'%'?? WITH?? GRANT?? OPTION??
    ??????? //賦予任何主機訪問數據的權限??
    ? 3、mysql>FLUSH?? PRIVILEGES??
    ??????? //修改生效??
    ? 4、mysql>EXIT??
    ??????? //退出MySQL服務器??
    ? 這樣就可以在其它任何的主機上以root身份登錄啦!

    創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

    總結

    以上是生活随笔為你收集整理的ubuntu 手动安装mysql的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。