Menu

MySQL Installation, Mac CML

2.4.1 General Notes on Installing MySQL on OS X

You should keep the following issues and notes in mind:

  • As of MySQL server 5.5.45, the DMG bundles a launchd daemon instead of the deprecated startup item. Startup items do not function as of OS X 10.10 (Yosemite), so using launchd is preferred. The available MySQL preference pane under OS X System Preferences was also updated to use launchd.
  • You may need (or want) to create a specific mysql user to own the MySQL directory and data. You can do this through the Directory Utility, and the mysql user should already exist. For use in single user mode, an entry for _mysql (note the underscore prefix) should already exist within the system /etc/passwd file.
  • Because the MySQL package installer installs the MySQL contents into a version and platform specific directory, you can use this to upgrade and migrate your database between versions. You will need to either copy the data directory from the old version to the new version, or alternatively specify an alternative datadir value to set location of the data directory. By default, the MySQL directories are installed under /usr/local/.
  • You might want to add aliases to your shell’s resource file to make it easier to access commonly used programs such as mysql and mysqladmin from the command line. The syntax for bash is:
    alias mysql=/usr/local/mysql/bin/mysql
    alias mysqladmin=/usr/local/mysql/bin/mysqladmin

    For tcsh, use:

    alias mysql /usr/local/mysql/bin/mysql
    alias mysqladmin /usr/local/mysql/bin/mysqladmin

    Even better, add /usr/local/mysql/bin to your PATH environment variable. You can do this by modifying the appropriate startup file for your shell. For more information, see Section 4.2.1, “Invoking MySQL Programs”.

Verifying MySQL Installation

After MySQL, has been successfully installed, the base tables have been initialized and the server has been started: you can verify that everything is working as it should be via some simple tests.

Use the mysqladmin Utility to Obtain Server Status

Use mysqladmin binary to check the server version. This binary would be available in /usr/bin on linux and in C:\mysql\bin on windows.

[root@host]# mysqladmin --version

It will produce the following result on Linux. It may vary depending on your installation −

mysqladmin  Ver 8.23 Distrib 5.0.9-0, for redhat-linux-gnu on i386

If you do not get such a message, then there may be some problem in your installation and you would need some help to fix it.

Execute simple SQL commands using the MySQL Client

You can connect to your MySQL server through the MySQL client and by using the mysql command. At this moment, you do not need to give any password as by default it will be set as blank.

You can just use following command −

[root@host]# mysql

It should be rewarded with a mysql> prompt. Now, you are connected to the MySQL server and you can execute all the SQL commands at the mysql> prompt as follows −

mysql> SHOW DATABASES;
+----------+
| Database |
+----------+
|   mysql  | 
|   test   |  
+----------+
2 rows in set (0.13 sec)

Post-installation Steps

MySQL ships with a blank password for the root MySQL user. As soon as you have successfully installed the database and the client, you need to set a root password as given in the following code block −

[root@host]# mysqladmin -u root password "new_password";

Now to make a connection to your MySQL server, you would have to use the following command −

[root@host]# mysql -u root -p
Enter password:*******

UNIX users will also want to put your MySQL directory in your PATH, so you won’t have to keep typing out the full path everytime you want to use the command-line client.

For bash, it would be something like −

export PATH = $PATH:/usr/bin:/usr/sbin

Running MySQL at Boot Time

If you want to run the MySQL server at boot time, then make sure you have the following entry in the /etc/rc.local file.

/etc/init.d/mysqld start

Also,you should have the mysqld binary in the /etc/init.d/ directory.

 

 

Cited from https://dev.mysql.com/doc/refman/5.5/en/osx-installation-notes.html

https://www.tutorialspoint.com/mysql/mysql-installation.htm

Advertisements

Fork A Repo

Fork A Repo

fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.

Most commonly, forks are used to either propose changes to someone else’s project or to use someone else’s project as a starting point for your own idea.

Propose changes to someone else’s project

A great example of using forks to propose changes is for bug fixes. Rather than logging an issue for a bug you’ve found, you can:

  • Fork the repository.
  • Make the fix.
  • Submit a pull request to the project owner.

If the project owner likes your work, they might pull your fix into the original repository!

Use someone else’s project as a starting point for your own idea.

At the heart of open source is the idea that by sharing code, we can make better, more reliable software.

When creating your public repository from a fork of someone’s project, make sure to include a license file that determines how you want your project to be shared with others.

For more information on open source, specifically how to create and grow an open source project, we’ve created Open Source Guides that will help you foster a healthy open source community by recommending best practices for creating and maintaining repositories for your open source project.

Fork an example repository

Forking a repository is a simple two-step process. We’ve created a repository for you to practice with!

  1. On GitHub, navigate to the octocat/Spoon-Knife repository.
  2. Fork buttonIn the top-right corner of the page, click Fork.

That’s it! Now, you have a fork of the original octocat/Spoon-Knife repository.

Keep your fork synced

You might fork a project in order to propose changes to the upstream, or original, repository. In this case, it’s good practice to regularly sync your fork with the upstream repository. To do this, you’ll need to use Git on the command line. You can practice setting the upstream repository using the same octocat/Spoon-Knife repository you just forked!

Step 1: Set Up Git

If you haven’t yet, you should first set up Git. Don’t forget to set up authentication to GitHub from Git as well.

Step 2: Create a local clone of your fork

Right now, you have a fork of the Spoon-Knife repository, but you don’t have the files in that repository on your computer. Let’s create a clone of your fork locally on your computer.

  1. On GitHub, navigate to your fork of the Spoon-Knife repository.
  2. Clone or download buttonUnder the repository name, click Clone or download.
  3. Clone URL buttonIn the Clone with HTTPs section, click  to copy the clone URL for the repository.
  4. Open Terminal.
  5. Type git clone, and then paste the URL you copied in Step 2. It will look like this, with your GitHub username instead of YOUR-USERNAME:
    git clone https://github.com/YOUR-USERNAME/Spoon-Knife
    
  6. Press Enter. Your local clone will be created.
    git clone https://github.com/YOUR-USERNAME/Spoon-Knife
    Cloning into `Spoon-Knife`...
    remote: Counting objects: 10, done.
    remote: Compressing objects: 100% (8/8), done.
    remove: Total 10 (delta 1), reused 10 (delta 1)
    Unpacking objects: 100% (10/10), done.
    

Now, you have a local copy of your fork of the Spoon-Knife repository!

Step 3: Configure Git to sync your fork with the original Spoon-Knife repository

When you fork a project in order to propose changes to the original repository, you can configure Git to pull changes from the original, or upstream, repository into the local clone of your fork.

  1. On GitHub, navigate to the octocat/Spoon-Knife repository.
  2. Clone or download buttonUnder the repository name, click Clone or download.
  3. Clone URL buttonIn the Clone with HTTPs section, click  to copy the clone URL for the repository.
  4. Open Terminal.
  5. Change directories to the location of the fork you cloned in Step 2: Create a local clone of your fork.
    • To go to your home directory, type just cd with no other text.
    • To list the files and folders in your current directory, type ls.
    • To go into one of your listed directories, type cd your_listed_directory.
    • To go up one directory, type cd ...
  6. Type git remote -v and press Enter. You’ll see the current configured remote repository for your fork.
    git remote -v
    origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
    origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
    
  7. Type git remote add upstream, and then paste the URL you copied in Step 2 and press Enter. It will look like this:
    git remote add upstream https://github.com/octocat/Spoon-Knife.git
    
  8. To verify the new upstream repository you’ve specified for your fork, type git remote -vagain. You should see the URL for your fork as origin, and the URL for the original repository as upstream.
    git remote -v
    origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
    origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
    upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
    upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)
    

Now, you can keep your fork synced with the upstream repository with a few Git commands. For more information, see “Syncing a fork.”

Next Steps

The sky’s the limit with the changes you can make to a fork, including:

  • Creating branches: Branches allow you to build new features or test out ideas without putting your main project at risk.
  • Opening pull requests: If you are hoping to contribute back to the original repository, you can send a request to the original author to pull your fork into their repository by submitting a pull request.

Cited from: https://help.github.com/articles/fork-a-repo/

Github “fatal: remote origin already exists”

$ git remote set-url origin git@github.com:ppreyer/first_app.git

Long version:

As the error message indicates, there is already a remote configured with the same name. So you can either add the new remote with a different name or update the existing one if you don’t need it:

To add a new remote, called for example github instead of origin (which obviously already exists in your system), do the following:

$ git remote add github git@github.com:ppreyer/first_app.git

Remember though, everywhere in the tutorial you see “origin” you should replace it with “github”. For example $ git push origin master should now be $ git push github master.

However, if you want to see what that origin which already exists is, you can do a $ git remote -v. If you think this is there by some error, you can update it like so:

$ git remote set-url origin git@github.com:ppreyer/first_app.git

Reference: https://stackoverflow.com/questions/10904339/github-fatal-remote-origin-already-exists

Start a new git repository

Your first instinct, when you start to do something new, should be git init. You’re starting to write a new paper, you’re writing a bit of code to do a computer simulation, you’re mucking around with some new data … anything: think git init.

A new repo from scratch

Say you’ve just got some data from a collaborator and are about to start exploring it.

  • Create a directory to contain the project.
  • Go into the new directory.
  • Type git init.
  • Write some code.
  • Type git add to add the files (see the typical use page).
  • Type git commit.

The first file to create (and add and commit) is probably a ReadMe file, either as plain text or with Markdown, describing the project.

Markdown allows you to add a bit of text markup, like hyperlinksbold/italics, or to indicate code with a monospace font. Markdown is easily converted to html for viewing in a web browser, and GitHub will do this for you automatically.

A new repo from an existing project

Say you’ve got an existing project that you want to start tracking with git.

  • Go into the directory containing the project.
  • Type git init.
  • Type git add to add all of the relevant files.
  • You’ll probably want to create a .gitignore file right away, to indicate all of the files you don’t want to track. Use git add .gitignore, too.
  • Type git commit.

Connect it to github

You’ve now got a local git repository. You can use git locally, like that, if you want. But if you want the thing to have a home on github, do the following.

  • Go to github.
  • Log in to your account.
  • Click the new repository button in the top-right. You’ll have an option there to initialize the repository with a README file, but I don’t.
  • Click the “Create repository” button.

Now, follow the second set of instructions, “Push an existing repository…”

$ git remote add origin git@github.com:username/new_repo
$ git push -u origin master

Actually, the first line of the instructions will say

$ git remote add origin https://github.com/username/new_repo

But I use git@github.com:username/new_repo rather than https://github.com/username/new_repo, as the former is for use with ssh (if you set up ssh as I mentioned in “Your first time”, then you won’t have to type your password every time you push things to github). If you use the latter construction, you’ll have to type your github password every time you push to github.

NextContribute to someone’s repository

 

Cited from: http://kbroman.org/github_tutorial/pages/init.html

git setup

1. Generating a new SSH key and adding it to the ssh-agent

Generating a new SSH key

  1. Open Terminal.
  2. Paste the text below, substituting in your GitHub email address.
    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
    

    This creates a new ssh key, using the provided email as a label.

    Generating public/private rsa key pair.
    
  3. When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the default file location.
    Enter a file in which to save the key (/home/you/.ssh/id_rsa): [Press enter]
    
  4. At the prompt, type a secure passphrase. For more information, see “Working with SSH key passphrases”.
    Enter passphrase (empty for no passphrase): [Type a passphrase]
    Enter same passphrase again: [Type passphrase again]
    

Adding your SSH key to the ssh-agent

Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key.

  1. Start the ssh-agent in the background.
    eval "$(ssh-agent -s)"
    Agent pid 59566
  2. Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.
    ssh-add ~/.ssh/id_rsa
  3. Add the SSH key to your GitHub account.

2. Adding a new SSH key to your GitHub account

  1. Copy the SSH key to your clipboard.

    If your SSH key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don’t add any newlines or whitespace.

    $ sudo apt-get install xclip
    # Downloads and installs xclip. If you don't have `apt-get`, you might need to use another installer (like `yum`)
    
    $ xclip -sel clip < ~/.ssh/id_rsa.pub
    # Copies the contents of the id_rsa.pub file to your clipboard
    

    Tip: If xclip isn’t working, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.

  2. Settings icon in the user barIn the upper-right corner of any page, click your profile photo, then click Settings.
  3. Authentication keysIn the user settings sidebar, click SSH and GPG keys.
  4. SSH Key buttonClick New SSH key or Add SSH key.
  5. In the “Title” field, add a descriptive label for the new key. For example, if you’re using a personal Mac, you might call this key “Personal MacBook Air”.
  6. The key fieldPaste your key into the “Key” field.
  7. The Add key buttonClick Add SSH key.
  8. Sudo mode dialogIf prompted, confirm your GitHub password.

 

 

###########################################################

3. Set git user name/email

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

4. Add git remote url

git remote set-url origin git://github.com/YourDirectory/YourProject.git
###########################################################

Problem may encounter

When using git, there is an error message saying:

X11 forwarding request failed on channel 0

Solution:

Look for ForwardX11 yes in ~/.ssh/config or /etc/ssh/ssh_config and set it to no. This will prevent ssh from attempting to use X11 forwarding for every connection.

Install gcc new version & set as default

Remove all update-alternatives

sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7

Default_Dedicated_bearer_Creation in LTE network

This document will explain about the new bearer allocation on top of default bearer.

First we will cover the default bearer creation and then we will cover the allocation of dedicated bearer.

Default Bearer Creation:

Here I will elaborate more on GTP perspective for creating default bearer. Please refer the following points when attach request initiated by UE,

  1. UE initiate a “Attach Request” towards eNB with the UE information such as IMSI, UE Core Network Capability, Attach Type, NAS information, RRC parameters etc.
  2. ENB derives MME from RRC parameter and forward the “Attach Request” i.e. S1-MME message (Initial UE Message) towards MME with the Selected Network, CSG ID (Common subscriber group), and TAI+ECGI information.
  3. MME will initiate a GTP-C signaling message towards S-GW to proceed with attach. This will help the EPS (Evolved Packet system) to create default bearer in the network. MME initiates Create Session Request with the following important information
    1. IMSI
    2. MME’s F-TEID for control plane (MME IP + TEID (Tunnel ID)). This will be used for future communication with MME.
    3. PGW’s G-TEID for Control plane (P-GW IP + TEID (here it will be zero)). This will be used by S-GW to communicate with P-GW.
    4. Bearer Context to be created. This is the bearer information to be created at MME. This will include the default bearer ID with TFT, QOS.
    5. APN
    6. Recovery
  4.   S-GW will process the “Create Session Request” initiated by MME and create the UE, eNB, and MME context and modify the Create session Request and send it to P-GW. Create session Request from S-GW will have the following important information
    1. IMSI
    2. S-GW’s F-TEID for control plane (S-GW IP + TEID (Tunnel ID)). This will be used for future communication with S-GW.
    3. Bearer Context to be created. This is the bearer information to be created at S-GW. This will include the default bearer ID with TFT, QOS, S-GW user plane F-TEID
    4. APN
    5. Recovery
  5.  Once P-GW receives “Create Session Request” , it will create UE, S-GW context and communicate with PCRF for QOS and APN resolve. If that succeed, P-GW will respond back with “Create Session Response” towards S-GW. The Create Session Response will have following information:
    1. Cause. This value will be used for Success/failure for the Create Session Request.
    2. P-GW’s F-TEID for control plane (P-GW’s IP + TEID ). This information will be used for future signaling message communication with P-GW.
    3. PAA (PDN Address Allocation).
    4. Bearer Contexts Created. This information element will have Default EPS bearer ID, P-GW user plane F-TEID, TFT, Bearer Qos, Charging ID.
    5. Charging GW
    6. Recovery
  6. Once S-GW receives “Create Session Response”, it will create P-GW context and forward/process the “Create Session Response “with the following information.
    1.  Cause. This value will be used for Success/failure for the Create Session Request.
    2. S-GW’s F-TEID for control plane (S-GW’s IP + TEID ). This information will be used for future signaling message communication with S-GW.
    3. PAA (PDN Address Allocation).
    4. Bearer Contexts Created. This information element will have Default EPS bearer ID, P-GW user plane F-TEID, TFT, Bearer Qos, Charging ID.
    5. Charging GW
    6. Recovery
  7. Now if downlink data comes from PDN it will get buffered in S-GW as user plane eNB information shared with S-GW.
  8. MME shares the eNB information as part of attach procedure with “Modify Bearer request” with the following information. (Bearer Contexts to be modified. This IE will have eNB’s user plane F-TEID.)
  9. Once S-GW receives the “Modify Bearer request” with eNB information.  It will respond back with “Modify bearer Response”.
  10. Now downlink data can be sent to eNB because S-GW has the information of eNB.
  11. But uplink data can possible after step 6.

Cited from:

http://lte-gtp.blogspot.com/2012/02/defaultdedicatedbearercreation-in-lte.html