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、改表法??赡苁悄愕膸ぬ柌辉试S從遠程登陸,只能在localhost。這個時候只要在localhost的那臺電腦,登入mysql后,更改 "mysql" 數據庫里的 "user" 表里的 "host" 項,從"localhost"改稱"%"
Sql代碼
3、如果你想允許用戶myuser從ip為192.168.1.6的主機連接到mysql服務器,并使用mypassword作為密碼
?
Sql代碼
注意授權后必須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的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 梦到老婆嫁人怎么解释
- 下一篇: JSF 2.0/2.1 生命周期简介