Ubuntu under Golang+mysql

Source: Internet
Author: User
Tags autoload
This is a creation in Article, where the information may have evolved or changed.

[Go install]

Originally used sudo apt-get install Golang installation, later found that this is installed GO1 version, so after the compilation Go-sql-driver plugin will have a problem.

Later, as mentioned in reference 2, download the corresponding platform package from Http://www.golangtc.com/download.

Installation is actually very simple, as long as the simple configuration of environment variables, in the. BASHRC Increase

Export goroot= $HOME/bin/go
Export GOARCH=AMD64 #如果是32位就是 =386
Export Goos=linux
Export Path=${path}: $GOROOT/bin
Export Gopath= $HOME/devhome/golang/go_demo

Then execute:

CD $GOROOT/SRC
./all.bash

Just wait for him to finish the load.

[Installation of MySQL]

This is done with Apt-get. As per reference 1, it is simple and convenient:

sudo apt-get install mysql-server mysql-client

New Added Users:

CREATE USER Steven identified by ' XXX ';

Empowerment:

GRANT all privileges on *. * to Steven;

[Go-sql-driver Installation]

With git, go straight to get github.com/go-sql-driver/mysql.

[Vim highlighting for Go syntax]

After configuring the GOROOT environment variable, execute the following script:

Mkdir-p $HOME/.vim/ftdetect
Mkdir-p $HOME/.vim/syntax
Mkdir-p $HOME/.vim/autoload/go
Ln-s $GOROOT/misc/vim/ftdetect/gofiletype.vim $HOME/.vim/ftdetect/
Ln-s $GOROOT/misc/vim/syntax/go.vim $HOME/.vim/syntax
Ln-s $GOROOT/misc/vim/autoload/go/complete.vim $HOME/.vim/autoload/go
echo "Syntax on" >> $HOME/.VIMRC

Resources

    1. Http://wiki.ubuntu.org.cn/MySQL
    2. Ubuntu Configuration Go Language development environment (Sublime Text+gosublime)
    3. Go-sql-driver/mysql
    4. The "The Go" Chinese version
    5. "Go Language Programming"
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.